services: db: image: postgres:16 container_name: db env_file: - .env ports: - "${PGPORT}:${PGPORT}" volumes: - postgres-db:/var/lib/postgresql/data environment: - POSTGRES_USER=${PGUSER} - POSTGRES_PASSWORD=${PGPASSWORD} - POSTGRES_DB=${PGDATABASE} restart: unless-stopped api: container_name: api build: context: ./api dockerfile: Dockerfile env_file: - .env ports: - "${SERVER_PORT}:${SERVER_PORT}" volumes: - api:/usr/src/app depends_on: - db command: ./bin/api restart: unless-stopped migrator: container_name: migrator build: context: ./migrator dockerfile: Dockerfile env_file: - .env depends_on: - api - db volumes: - goose:/migrations command: goose up restart: unless-stopped spa: container_name: spa build: context: ./spa dockerfile: Dockerfile env_file: - .env ports: - "${HTTP_OUTER_PORT}:${HTTP_INNER_PORT}" - "${HTTPS_OUTER_PORT}:${HTTPS_INNER_PORT}" depends_on: - api - db - migrator restart: unless-stopped nginx: build: context: ./nginx dockerfile: Dockerfile env_file: - .env container_name: nginx restart: unless-stopped ports: - "80:80" - "443:443" volumes: - ./nginx/yalarba.ru.conf:/etc/nginx/conf.d/yalarba.ru.conf - certbot-etc:/etc/letsencrypt - certbot-var:/var/lib/letsencrypt environment: - EMAIL=${EMAIL} - DOMAINS=${DOMAINS} networks: - web-network certbot: container_name: certbot build: context: ./certbot dockerfile: Dockerfile env_file: - .env restart: unless-stopped volumes: api: postgres-db: goose: certbot-etc: certbot-var: networks: web-network: driver: bridge