Files
tp/docker-compose.yaml
T

105 lines
2.0 KiB
YAML

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/configs:/etc/nginx/conf.d
- certbot-etc:/etc/letsencrypt
networks:
- web-network
depends_on:
- certbot
certbot:
image: certbot/certbot
container_name: certbot
volumes:
- certbot-etc:/etc/letsencrypt
- certbot-var:/var/lib/letsencrypt
command: sh -c "certbot certonly --standalone --noninteractive --agree-tos --email ${EMAIL} -d ${DOMAINS} --keep-until-expiring"
env_file:
- .env
restart: unless-stopped
volumes:
api:
postgres-db:
goose:
certbot-etc:
certbot-var:
networks:
web-network:
driver: bridge