backend/Dockerfile
Fred Boniface 0aa42c4743 Add dockerfilec omment
Signed-off-by: Fred Boniface <fred@fjla.uk>
2023-08-30 20:28:46 +01:00

20 lines
524 B
Docker

FROM node:20 as builder
WORKDIR /usr/src/app
COPY ./package*.json ./
COPY ./.npmrc ./
RUN npm install
COPY . .
# Ideally the tests should be run separately in a CI/CD workflow rather than during the build
# Currently, it does prevent a container being published with failing tests
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" ]