fix(docker): fix Dockerfiles of backend and frontend

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-02-04 14:44:57 +01:00
parent 74178b6edf
commit 69a7a1ae69
2 changed files with 16 additions and 7 deletions

View file

@ -86,8 +86,15 @@ USER node
WORKDIR /usr/src/app
ENV NODE_ENV=production
COPY --chown=node --from=builder /usr/src/app/backend/dist ./
COPY --chown=node backend/package.json package.json
COPY --chown=node package.json package.json
COPY --chown=node --from=prod-dependencies /usr/src/app/node_modules ./node_modules
CMD ["node", "main.js"]
COPY --chown=node backend/package.json backend/package.json
COPY --chown=node --from=builder /usr/src/app/backend/dist backend/dist
COPY --chown=node backend/public backend/public
COPY --chown=node commons/package.json /usr/src/app/commons/package.json
COPY --chown=node --from=prod-dependencies /usr/src/app/commons/dist commons/dist
WORKDIR /usr/src/app/backend
CMD ["node", "dist/main.js"]

View file

@ -43,12 +43,14 @@ ENV NEXT_TELEMETRY_DISABLED=1
WORKDIR /usr/src/app
COPY --from=builder --chown=node:node /usr/src/app/frontend/.next/standalone ./
COPY --from=builder --chown=node:node /usr/src/app/frontend/.next/static ./.next/static
COPY --from=builder /usr/src/app/frontend/next.config.js next.config.js
COPY --from=builder /usr/src/app/frontend/public ./public
COPY --from=builder --chown=node:node /usr/src/app/frontend/.next/static ./frontend/.next/static
COPY --from=builder /usr/src/app/frontend/next.config.js ./frontend/next.config.js
COPY --from=builder /usr/src/app/frontend/public ./frontend/public
USER node
ENV PORT 3001
EXPOSE 3001/tcp
CMD ["node", "frontend/server.js"]
WORKDIR /usr/src/app/frontend
CMD ["node", "server.js"]