diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..65d352863 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +# node_modules contains dependecies necessary only for build +node_modules + +# directory will be autogenerated on a successfull build +dist + +# not necessary for a build +test \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..23f62e60b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM node:14-alpine as build-stage +WORKDIR /app +COPY package*.json ./ +RUN npm ci +WORKDIR /app +COPY ./ . +RUN npm run build + +FROM node:14-alpine as production-stage +COPY --from=build-stage /app/dist ./dist + +USER node +ENV PORT=8081 +EXPOSE 8081 + +CMD [ "node", "dist/main.js" ] \ No newline at end of file