diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f028795 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM 'node:14' + +RUN mkdir -p /usr/src/app/src/ +WORKDIR /usr/src/app/ + +COPY ./src /usr/src/app/src +COPY ./package.json /usr/src/app/package.json +COPY ./.env /usr/src/app/.env + +RUN npm install --only=prod +EXPOSE 8043 + +CMD ["npm", "run", "up:prod"] diff --git a/d-scripts/rerun.sh b/d-scripts/rerun.sh new file mode 100644 index 0000000..f6cfce1 --- /dev/null +++ b/d-scripts/rerun.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +docker stop $(docker ps -q) +docker volume remove multy_stub_volume +docker volume create multy_stub_volume +docker run --rm -v multy_stub_volume:/data/db -p 27017:27017 -d mongo diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..14acbd3 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,21 @@ +version: "3" + +volumes: + red-coder_volume: + +services: + mongoDb: + image: mongo:latest + volumes: + - red-coder_volume:/data/db + restart: always + # ports: + # - 27017:27017 + red-coder: + build: . + restart: always + ports: + - 8043:8043 + environment: + - TZ=Europe/Moscow + - MONGO_ADDR=mongodb \ No newline at end of file diff --git a/package.json b/package.json index 66737a5..e2f3e98 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,11 @@ "scripts": { "start": "nodemon", "build": "tsc", - "up:prod": "node dist/main" + "up:prod": "node dist/main", + "deploy:d:stop": "docker-compose down", + "deploy:d:build": "docker-compose build", + "deploy:d:up": "docker-compose up -d", + "redeploy": "npm run deploy:d:stop && npm run deploy:d:build && npm run deploy:d:up" }, "nodemonConfig": { "ignore": [