fix: Docker compose build for production

This commit is contained in:
Aleksi Lassila
2024-04-20 02:38:30 +03:00
parent 8928155447
commit 35688dd72c
7 changed files with 16 additions and 11 deletions

View File

@@ -12,6 +12,10 @@ RUN npm i
RUN npm run build
RUN npm i --prefix backend
RUN npm run build --prefix backend
FROM --platform=linux/amd64 node:18-alpine as production
RUN mkdir -p /usr/src/app
@@ -19,10 +23,11 @@ WORKDIR /usr/src/app
ENV NODE_ENV=production
COPY --from=pre-production /usr/src/app/build ./build
COPY --from=pre-production /usr/src/app/backend/dist ./dist
COPY --from=pre-production /usr/src/app/dist ./dist/dist
COPY package.json .
COPY package-lock.json .
COPY backend/package.json .
COPY backend/package-lock.json .
RUN npm ci --omit dev
@@ -30,7 +35,7 @@ RUN mkdir -p ./config
RUN ln -s /usr/src/app/config /config
CMD [ "npm", "run", "deploy" ]
CMD [ "npm", "run", "start:prod" ]
FROM node:18 as development
@@ -48,4 +53,4 @@ RUN mkdir -p ./config
RUN ln -s /usr/src/app/config /config
CMD [ "npm", "run", "dev" ]
CMD [ "npm", "run", "dev" ]