From 3b09eb4230e7649cc9738052259c76832e9d1cd6 Mon Sep 17 00:00:00 2001 From: Phill Pover Date: Wed, 2 Apr 2025 17:22:21 +0100 Subject: [PATCH] Changing Dockerfile --- frontend/Dockerfile | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index be9d377..d19cb91 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,27 +1,13 @@ -FROM node:18-alpine as base -RUN apk add --no-cache g++ make py3-pip libc6-compat -WORKDIR /app -COPY package*.json ./ -EXPOSE 3000 - -FROM base as builder +# Build Stage +FROM node:23-alpine AS build WORKDIR /app +COPY ./package*.json ./ +RUN npm install COPY . . RUN npm run build -FROM base as production -WORKDIR /app - -ENV NODE_ENV=production -RUN npm ci - -RUN addgroup -g 1001 -S nodejs -RUN adduser -S nextjs -u 1001 -USER nextjs - -COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/package.json ./package.json -COPY --from=builder /app/public ./public - -CMD npm start +# Production Stage +FROM nginx:stable-alpine AS production +COPY --from=build /app/build /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"]