hishtory/backend/server/docker-compose.yml
Sergio Moura a3e6d5a940 docker improvements:
* use alpine for small docker images
* use docker compose to wait for the database to be ready
* use a single Dockerfile with parameters to determine the correct GOARCH
* update makefile to account for the new GOARCH parameter on the Dockerfile
* remove native-arch-Dockerfile
2023-09-07 11:06:32 -04:00

48 lines
1.4 KiB
YAML

# A docker-compose file to host a hiSHtory backend. To use:
# 1. Update TODO_YOUR_POSTGRES_PASSWORD_HERE
# 2. `docker compose -f backend/server/docker-compose.yml build`
# 3. `docker compose -f backend/server/docker-compose.yml up`
# 4. Point your hiSHtory client at the server by putting `export HISHTORY_SERVER=http://1.2.3.4` in your shellrc
# 5. Run `hishtory init` to initialize hiSHtory with the local server
# 6. [Optional, but recommended] Add a TLS proxy to enable https
version: "3.8"
networks:
hishtory:
driver: bridge
services:
postgres:
image: postgres
restart: unless-stopped
networks:
- hishtory
environment:
POSTGRES_PASSWORD: TODO_YOUR_POSTGRES_PASSWORD_HERE
POSTGRES_DB: hishtory
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: pg_isready -U postgres
interval: 10s
timeout: 3s
hishtory:
depends_on:
postgres:
condition: service_healthy
networks:
- hishtory
build:
context: ../../
dockerfile: ./backend/server/Dockerfile
restart: unless-stopped
deploy:
restart_policy:
condition: on-failure
delay: 3s
environment:
HISHTORY_POSTGRES_DB: postgresql://postgres:TODO_YOUR_POSTGRES_PASSWORD_HERE@postgres:5432/hishtory?sslmode=disable
ports:
- 80:8080
volumes:
postgres-data: