44 lines
980 B
YAML
44 lines
980 B
YAML
version: '3.9'
|
|
services:
|
|
flask:
|
|
build:
|
|
dockerfile: Dockerfile
|
|
context: .
|
|
environment:
|
|
# DATABASE DETAILS
|
|
- DBNAME=test_db
|
|
- DBUSER=postgres
|
|
- DBPASS=postgres
|
|
- DBPORT=5432 # Corrected port for PostgreSQL
|
|
- DBHOST=postgres # Corrected host name
|
|
ports:
|
|
- "8050:1602" # Exposes Flask app on localhost:8050
|
|
networks:
|
|
- test-net
|
|
depends_on:
|
|
- postgres # Ensures Flask starts after PostgreSQL is up
|
|
|
|
postgres:
|
|
container_name: db_postgres
|
|
image: postgres
|
|
hostname: postgres
|
|
ports:
|
|
- "5432:5432" # Exposes PostgreSQL on localhost:5432
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: test_db # Ensures the database is created
|
|
volumes:
|
|
- postgres-volume:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
networks:
|
|
- test-net
|
|
|
|
volumes:
|
|
postgres-volume:
|
|
|
|
networks:
|
|
test-net:
|
|
driver: bridge
|
|
|