From f6bb213c789e49110d309fd3d8bcb48ab86877d3 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sat, 21 Oct 2023 15:53:24 +0800 Subject: [PATCH] chore: add local build docker-compose file --- .env.example | 2 +- docker-compose.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml diff --git a/.env.example b/.env.example index 297d134..fccbcfb 100644 --- a/.env.example +++ b/.env.example @@ -8,6 +8,6 @@ ALLOW_REGISTER= WEBSITE_ID= # For secury -JWT_SECRET=some-random-string # default is `daily string` +JWT_SECRET=replace-with-random-string # default is `daily string` JWT_ISSUER= # default is `tianji.msgbyte.com` JWT_AUDIENCE= # default is `msgbyte.com` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a544354 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,32 @@ +version: '3' +services: + tianji: + image: tianji + build: + context: . + ports: + - "12345:12345" + environment: + DATABASE_URL: postgresql://tianji:tianji@db:5432/tianji + JWT_SECRET: replace-me-with-a-random-string + ALLOW_REGISTER: false + depends_on: + db: + condition: service_healthy + restart: always + postgres: + image: postgres:15.4-alpine + environment: + POSTGRES_DB: tianji + POSTGRES_USER: tianji + POSTGRES_PASSWORD: tianji + volumes: + - tianji-db-data:/var/lib/postgresql/data + restart: always + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] + interval: 5s + timeout: 5s + retries: 5 +volumes: + tianji-db-data: