From f3caa4ef878fc32a37e6e7a5268cd4925d0a7a46 Mon Sep 17 00:00:00 2001 From: Daniil Date: Mon, 22 Dec 2025 19:36:07 +0300 Subject: [PATCH] First commit in my branch --- werf.yaml | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 werf.yaml diff --git a/werf.yaml b/werf.yaml new file mode 100644 index 0000000..a4ade88 --- /dev/null +++ b/werf.yaml @@ -0,0 +1,109 @@ +--- +project: s21game2-frontend +configVersion: 1 +build: + platform: + - linux/amd64 + imageSpec: + author: s21party + config: + keepEssentialWerfLabels: true + +--- +image: frontend_base +platform: + - linux/amd64 +from: registry.corp.s21party.ru/public-mirrors/node:25.2.1-alpine3.22 + +--- +image: frontend_deps +platform: + - linux/amd64 +from: frontend_base +git: + - add: / + to: /app + includePaths: + - package.json + - package-lock.json + stageDependencies: + install: + - package.json + - package-lock.json +shell: + beforeInstall: + - apk add --no-cache libc6-compat + install: + - cd /app + - | + if [ -f yarn.lock ]; then yarn --frozen-lockfile; + elif [ -f package-lock.json ]; then npm ci; + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; + else echo "Lockfile not found." && exit 1; + fi + +--- +image: frontend_builder +platform: + - linux/amd64 +from: frontend_base +imageSpec: + config: + workingDir: /app + env: + NEXT_TELEMETRY_DISABLED: "1" +git: + - add: / + to: /app +import: + - from: frontend_deps + before: install + add: /app/node_modules + to: /app/node_modules +shell: + install: + - cd /app + - | + if [ -f yarn.lock ]; then yarn run build; + elif [ -f package-lock.json ]; then npm run build; + elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; + else echo "Lockfile not found." && exit 1; + fi + +--- +image: frontend_runner +platform: + - linux/amd64 +from: frontend_base +imageSpec: + config: + workingDir: /app + env: + NODE_ENV: "production" + PORT: "3000" + HOSTNAME: "0.0.0.0" + cmd: ["node", "server.js"] + user: nextjs + expose: + - "3000" +import: + - from: frontend_builder + before: setup + add: /app/.next/standalone + to: /app + owner: "1001" + group: "1001" + - from: frontend_builder + before: setup + add: /app/.next/static + to: /app/.next/static + owner: "1001" + group: "1001" + - from: frontend_builder + before: setup + add: /app/public + to: /app/public +shell: + beforeSetup: + - addgroup --system --gid 1001 nodejs + - adduser --system --uid 1001 nextjs