Add alembic migration support to Docker*

This commit is contained in:
Darryl Nixon 2023-06-02 19:46:04 -07:00
parent ce30df0520
commit d05141075e
2 changed files with 9 additions and 2 deletions

View file

@ -34,4 +34,4 @@ EXPOSE ${ENV_GHOSTFORGE_INTERNAL_WEB_PORT}
# TODO: Replace with ghostforge_serve when it works. # TODO: Replace with ghostforge_serve when it works.
# This currently just keeps the container running for development. # This currently just keeps the container running for development.
CMD ["sh", "-c", "uvicorn ghostforge.serve:gf --host 0.0.0.0 --port $GHOSTFORGE_INTERNAL_WEB_PORT"] CMD ["sh", "-c", "alembic upgrade head && uvicorn ghostforge.serve:gf --host 0.0.0.0 --port $GHOSTFORGE_INTERNAL_WEB_PORT"]

View file

@ -4,6 +4,11 @@ services:
image: postgres:15.3 image: postgres:15.3
container_name: ghostforge-db container_name: ghostforge-db
restart: unless-stopped restart: unless-stopped
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 10s
timeout: 5s
retries: 5
volumes: volumes:
- ghostforge-db-data:/var/lib/postgresql/data - ghostforge-db-data:/var/lib/postgresql/data
ports: [ "5432:5432" ] ports: [ "5432:5432" ]
@ -25,7 +30,9 @@ services:
image: ghostforge:latest image: ghostforge:latest
container_name: ghostforge container_name: ghostforge
restart: unless-stopped restart: unless-stopped
depends_on: [ ghostforge-db ] depends_on:
ghostforge-db:
condition: service_healthy
env_file: [ .env ] env_file: [ .env ]
volumes: volumes:
- ./migrations/versions:/ghostforge/migrations/versions - ./migrations/versions:/ghostforge/migrations/versions