From 3db00a7a733c1da12512fd42fc60ce3c247e7842 Mon Sep 17 00:00:00 2001 From: Per Moberg Date: Wed, 28 Aug 2024 15:17:36 +0200 Subject: [PATCH] Move ARG GUI_VERSION to the layer that uses it Use new ENV var=value syntax for ENV as well. --- Dockerfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 88e2dbe..910bf08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ -ARG GUI_VERSION=dev FROM node:18-alpine AS base # Install dependencies only when needed @@ -19,6 +18,7 @@ RUN \ # Rebuild the source code only when needed FROM base AS builder +ARG GUI_VERSION=dev WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . @@ -26,7 +26,7 @@ COPY . . # Next.js collects completely anonymous telemetry data about general usage. # Learn more here: https://nextjs.org/telemetry # Uncomment the following line in case you want to disable telemetry during the build. -ENV NEXT_TELEMETRY_DISABLED 1 +ENV NEXT_TELEMETRY_DISABLED=1 RUN echo ${GUI_VERSION} > /app/gui-version.txt RUN npm run build @@ -35,9 +35,9 @@ RUN npm run build FROM base AS runner WORKDIR /app -ENV NODE_ENV production +ENV NODE_ENV=production # Uncomment the following line in case you want to disable telemetry during runtime. -ENV NEXT_TELEMETRY_DISABLED 1 +ENV NEXT_TELEMETRY_DISABLED=1 RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs @@ -49,11 +49,10 @@ COPY --from=builder /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder /app/gui-version.txt ./ - USER nextjs EXPOSE 3000 -ENV PORT 3000 +ENV PORT=3000 CMD ["node", "server.js"] \ No newline at end of file