diff --git a/compose/prod/api/Dockerfile b/compose/prod/api/Dockerfile index 77f1446..7f4a5f3 100644 --- a/compose/prod/api/Dockerfile +++ b/compose/prod/api/Dockerfile @@ -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 \ No newline at end of file diff --git a/compose/prod/web/Dockerfile b/compose/prod/web/Dockerfile new file mode 100644 index 0000000..cf3a151 --- /dev/null +++ b/compose/prod/web/Dockerfile @@ -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 \ No newline at end of file