Introduce Dockerfile for containerizing the application

This commit is contained in:
saadi 2023-03-22 13:02:32 +01:00
parent a9e39afb6d
commit f19b3aca80
2 changed files with 30 additions and 0 deletions

3
.dockerignore Normal file
View file

@ -0,0 +1,3 @@
node_modules
generated
dist

27
Dockerfile Normal file
View file

@ -0,0 +1,27 @@
FROM node:18-alpine3.17 as build
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
COPY src ./src
COPY api ./api
COPY env ./env
COPY tsconfig.json ./tsconfig.json
COPY tsconfig.prod.json ./tsconfig.prod.json
RUN yarn run build
FROM node:16-alpine3.15 as app
USER node
WORKDIR /app
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/env /app/dist/env
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/dist /app/dist
ENTRYPOINT node dist/src/server.js