From c0b9106fbd041b9dc2c05a9ad728fd4232e18eda Mon Sep 17 00:00:00 2001 From: SGhotra1 <73190872+SGhotra1@users.noreply.github.com> Date: Wed, 29 May 2024 11:33:31 +0200 Subject: [PATCH] build: copying build files in Dockerfile, reverted changes to frontend npm scripts --- packages/frontend/Dockerfile | 12 ++++++++---- packages/frontend/package.json | 5 ++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/frontend/Dockerfile b/packages/frontend/Dockerfile index 502e6207..35c55260 100644 --- a/packages/frontend/Dockerfile +++ b/packages/frontend/Dockerfile @@ -1,12 +1,16 @@ -FROM node:21-alpine3.18 as build +FROM node:21-alpine3.18 AS build WORKDIR /app COPY ./ /app/ RUN npm ci RUN npm run frontend:build -FROM node:21-alpine3.18 as run +FROM node:21-alpine3.18 AS run WORKDIR /app -COPY --from=build /app/packages/frontend/build/standalone ./ +COPY --from=build /app/packages/frontend/build/standalone/packages/frontend ./ +COPY --from=build /app/packages/frontend/build/standalone/node_modules ./node_modules +COPY --from=build /app/packages/frontend/build/standalone/packages/shared ./ +COPY --from=build /app/packages/frontend/public ./public +COPY --from=build /app/packages/frontend/build/static ./build/static -CMD ["npm", "run", "--prefix", "./packages/frontend", "startstandalone"] +CMD PORT=80 node server.js diff --git a/packages/frontend/package.json b/packages/frontend/package.json index dd2329e4..71ea6764 100644 --- a/packages/frontend/package.json +++ b/packages/frontend/package.json @@ -4,9 +4,8 @@ "private": true, "scripts": { "dev": "next dev", - "build": "next build && cp -r public build/standalone/packages/frontend && cp -r build/static build/standalone/packages/frontend/build/static", - "start": "PORT=80 node build/standalone/packages/frontend/server.js", - "startstandalone": "PORT=80 node server.js" + "build": "next build", + "start": "next start -p 80" }, "dependencies": { "@emotion/react": "^11.11.4",