Separated backend server build code from frontend build code
This commit is contained in:
parent
542b26f8d7
commit
d81faef133
2 changed files with 31 additions and 3 deletions
|
|
@ -17,10 +17,12 @@ FROM node:18-alpine
|
|||
|
||||
WORKDIR /app
|
||||
|
||||
RUN npm install -g serve
|
||||
COPY package*.json ./
|
||||
|
||||
COPY --from=builder /app/dist /app/dist
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
CMD ["serve", "-s", "dist", "-l", "3000"]
|
||||
COPY --from=builder /app/dist/apps/api ./
|
||||
|
||||
CMD ["node", "main.js"]
|
||||
|
||||
EXPOSE 3000
|
||||
26
compose/prod/web/Dockerfile
Normal file
26
compose/prod/web/Dockerfile
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
FROM node:18-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
LABEL org.opencontainers.image.source="TBC"
|
||||
LABEL org.opencontainers.image.description="FYP Image"
|
||||
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm run build:web
|
||||
|
||||
FROM node:18-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN npm install -g serve
|
||||
|
||||
COPY --from=builder /app/dist /app/dist
|
||||
|
||||
CMD ["serve", "-s", "dist", "-l", "3000"]
|
||||
|
||||
EXPOSE 3000
|
||||
Loading…
Reference in a new issue