chore: Added support for docker compose

This commit is contained in:
Danil 2025-04-11 11:46:58 +03:00
parent 97fa1bd066
commit b1a5cb279f
5 changed files with 61 additions and 1 deletions

7
.dockerignore Normal file
View file

@ -0,0 +1,7 @@
Dockerfile
.gitignore
.env.sample
config.sample.hjson
.git/
.DS_Store
.vscode/

10
.env.sample Normal file
View file

@ -0,0 +1,10 @@
# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
POSTGRES_PASSWORD=my_password
# If you do not know what you are doing, then you should not edit the values below
###################################################################################
POSTGRES_DB=kekkai
DB_HOST=postgres
POSTGRES_USER=postgres

3
.gitignore vendored
View file

@ -7,4 +7,5 @@ config.hjson
node_modules/
.DS_Store
.DS_Store
postgres-data/

13
Dockerfile Normal file
View file

@ -0,0 +1,13 @@
FROM node:20-alpine
WORKDIR /
COPY /package*.json .
RUN npm install
COPY /node_modules /node_modules
COPY . .
CMD ["node", "main.js"]

29
docker-compose.yaml Normal file
View file

@ -0,0 +1,29 @@
services:
parser:
build:
context: .
dockerfile: Dockerfile
volumes:
- './config.hjson:/config.hjson:ro'
depends_on:
- postgres
postgres:
image: postgres:latest
restart: unless-stopped
env_file: .env
ports:
- '5432:5432'
volumes:
- ./postgres-data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER"]
interval: 10s
timeout: 5s
retries: 5
volumes:
parser:
driver: local
postgres:
driver: local