48 lines
1.0 KiB
YAML
48 lines
1.0 KiB
YAML
networks:
|
|
url_shortener:
|
|
|
|
volumes:
|
|
postgres_data:
|
|
|
|
secrets:
|
|
web_secret_key:
|
|
file: ./web_secret_key.txt
|
|
postgres_password:
|
|
file: ./postgres_password.txt
|
|
|
|
services:
|
|
web:
|
|
build: .
|
|
image: pinlin/url-shortener:latest
|
|
restart: always
|
|
networks:
|
|
- url_shortener
|
|
secrets:
|
|
- web_secret_key
|
|
- postgres_password
|
|
environment:
|
|
SECRET_KEY_FILE: /run/secrets/web_secret_key
|
|
POSTGRES_HOST: postgres
|
|
POSTGRES_PORT: 5432
|
|
POSTGRES_DATABASE: url_shortener
|
|
POSTGRES_USERNAME: url_shortener
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
- postgres
|
|
|
|
postgres:
|
|
image: postgres:16.4-alpine
|
|
restart: always
|
|
networks:
|
|
- url_shortener
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data/
|
|
secrets:
|
|
- postgres_password
|
|
environment:
|
|
POSTGRES_DB: url_shortener
|
|
POSTGRES_USER: url_shortener
|
|
POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password
|