You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

84 lines
2.8 KiB

services:
postgres:
image: docker.io/apache/age:release_PG17_1.6.0
container_name: postgress_01
restart: unless-stopped
# Host port matches setup.sh, .env.example, and config defaults (5455 → container 5432).
ports:
- "5455:5432"
# Named volume avoids host uid mismatches (do not combine image postgres user with user: 1000 + ./pgdata).
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${POSTGRES_DB:-gc_index_relay_dev}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
command: >
postgres
deploy:
resources:
limits:
cpus: "1.00"
memory: 1G
reservations:
cpus: "0.50"
memory: 512M
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-gc_index_relay_dev}"]
interval: 10s
timeout: 5s
retries: 5
setup:
build:
context: .
dockerfile: ./docker/setup.Dockerfile
command: ["/usr/local/bin/usersetup.sh"]
restart: no
depends_on:
postgres:
condition: service_healthy
environment:
# Docker DNS name of this service (not localhost from .env — that is for host-side mix).
POSTGRES_HOST: postgres
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-gc_index_relay_dev}
POSTGRES_RUNTIME_USER: ${POSTGRES_RUNTIME_USER:-gc_index_relay}
POSTGRES_RUNTIME_PASSWORD: ${POSTGRES_RUNTIME_PASSWORD:-gc_index_relay_runtime}
migrator:
build:
context: .
dockerfile: ./docker/server.Dockerfile
command: ["/app/bin/migrate"]
restart: no
depends_on:
postgres:
condition: service_healthy
setup:
condition: service_completed_successfully
environment:
# Inside the compose network Postgres listens on 5432; 5455 is only the host publish port.
DATABASE_URL: "ecto://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-gc_index_relay_dev}"
SECRET_KEY_BASE: ${SECRET_KEY_BASE:-0000000000000000000000000000000000000000000000000000000000000000}
mercury:
build:
context: .
dockerfile: ./docker/server.Dockerfile
command: ["/app/bin/server"]
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
migrator:
condition: service_completed_successfully
ports:
- "4000:4000"
environment:
DATABASE_URL: "ecto://${POSTGRES_RUNTIME_USER:-gc_index_relay}:${POSTGRES_RUNTIME_PASSWORD:-gc_index_relay_runtime}@postgres:5432/${POSTGRES_DB:-gc_index_relay_dev}"
SECRET_KEY_BASE: ${SECRET_KEY_BASE:-0000000000000000000000000000000000000000000000000000000000000000}
volumes:
pgdata: