diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..44d646d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +dist/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..0db54c1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM node:lts as base + +WORKDIR /home/node/app + +COPY package*.json ./ + +RUN npm i + +COPY . . + +FROM base as production + +ENV NODE_PATH=./dist + +RUN npm run build + +EXPOSE 8081 +ENV PORT 8081 +ENV NODE_ENV production + +CMD [ "npm", "run" ,"start:prod" ] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0895b8e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3.8' +services: + server: + build: + context: . + dockerfile: ./Dockerfile + args: + - http_proxy + - https_proxy + - no_proxy + image: tsed/server:latest + restart: always + ports: + - "8081:8081" + stdin_open: true # -i + tty: true # -t