backend/Dockerfile

18 lines
425 B
Docker
Raw Normal View History

FROM node:20 as builder
WORKDIR /usr/src/app
COPY ./package*.json ./
RUN npm i
COPY . .
# Ideally the tests should be run separately in a CI/CD workflow rather than during the build
RUN npm run test
RUN npm run build
FROM node:20-slim
EXPOSE 8460
WORKDIR /usr/src/app
COPY ./mail-templates/* ./mail-templates/
COPY ./package*.json ./
RUN npm ci --omit=dev
COPY --from=builder /usr/src/app/dist/ ./
CMD [ "node" , "app.js" ]