From 25818b9ad7b10721bb66c89da0213e934456e308 Mon Sep 17 00:00:00 2001 From: Arda Erzin Date: Wed, 18 Dec 2024 17:52:33 +0100 Subject: [PATCH] fix(frontend): revert changes to prod.Dockerfile --- agenta-web/prod.Dockerfile | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/agenta-web/prod.Dockerfile b/agenta-web/prod.Dockerfile index d90924f5bd..7703db1223 100644 --- a/agenta-web/prod.Dockerfile +++ b/agenta-web/prod.Dockerfile @@ -1,17 +1,38 @@ -FROM node:20.18-slim +# Stage 1: Build Stage +FROM node:20.18-slim AS builder -# Set the working directory WORKDIR /app # Install only production dependencies COPY package.json package-lock.json* ./ RUN npm ci +# Copy only necessary files +COPY src ./src +COPY public ./public +COPY next.config.js . +COPY tsconfig.json . +COPY postcss.config.js . +COPY tailwind.config.ts . +COPY .env.production . +COPY sentry.* . -COPY . . - -RUN npx next telemetry disable +# Build the Next.js app for production RUN npm run build +# Stage 2: Production Stage +FROM node:20.18-slim AS prod + +WORKDIR /app + +# Copy only the necessary files from the build stage +COPY --from=builder /app/package.json /app/package-lock.json* /app +COPY --from=builder /app/.next /app/.next +COPY --from=builder /app/public /app/public +COPY --from=builder /app/next.config.js /app/tsconfig.json /app/postcss.config.js /app/tailwind.config.ts /app/.env.production /app/sentry.* /app/ + +# Install only production dependencies +RUN npm ci --omit=dev + # Expose the necessary port EXPOSE 3000