From ae957e1b6c31d5ee08b91e3b748e1b9a89c20e4c Mon Sep 17 00:00:00 2001 From: MaryWylde Date: Mon, 23 Feb 2026 15:55:01 +0400 Subject: [PATCH] chore: change Docker and Next configs --- Dockerfile | 39 +++++++++++++++++++++++++-------------- next.config.js | 1 + 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index f5f1999..06ca3d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,33 @@ -FROM node:20.19.0 AS base +FROM node:20.19.0-alpine AS deps + WORKDIR /app -FROM base AS deps -COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile +# Install dependencies (use lockfile if present for reproducible builds) +COPY package.json yarn.lock* ./ +RUN if [ -f yarn.lock ]; then yarn install --frozen-lockfile; else yarn install; fi -FROM base AS builder -COPY --from=deps /app/node_modules ./node_modules -COPY . . -RUN yarn run build +FROM node:20.19.0-alpine AS builder -FROM base AS runner +WORKDIR /app ENV NODE_ENV=production + +COPY . . +COPY --from=deps /app/node_modules ./node_modules + +RUN yarn run build:staging + +FROM node:20.19.0-alpine AS runner + WORKDIR /app -COPY --from=builder /app/package.json ./package.json -COPY --from=builder /app/next.config.js ./next.config.js +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 +ENV PORT=3005 + +# Copy only the minimal standalone output COPY --from=builder /app/public ./public -COPY --from=builder /app/.next ./.next -COPY --from=builder /app/node_modules ./node_modules +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static + EXPOSE 3005 -CMD ["yarn", "run", "start:staging"] + +CMD ["node", "server.js"] diff --git a/next.config.js b/next.config.js index d9b71a4..a90ddda 100644 --- a/next.config.js +++ b/next.config.js @@ -20,6 +20,7 @@ module.exports = async () => { defaultLocale: 'en', }, assetPrefix: isLocal ? '' : '/uxcore_next', + output: 'standalone', async rewrites() { return [ {