From bf5c3b209521029ea3c6b43971151437104f6391 Mon Sep 17 00:00:00 2001 From: Alexander Dadykin Date: Sun, 4 Sep 2022 21:36:11 +0200 Subject: [PATCH] Create DockerFile --- .dockerignore | 8 ++++++++ Dockerfile | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile 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