File size: 962 Bytes
c7a353e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
version: '3.8'

services:
  # Flask application service
  app:
    image: my-flask-app  # Use the image built for your Flask app
    build:
      context: .  # Build from Dockerfile in current directory
    ports:
      - "8000:8000"  # Map host port 7860 to container port 7860
    depends_on:
      - db  # Ensure the db service is started before the app
    environment:
      - FLASK_ENV=development
      - DATABASE_URL=postgresql://user:password@db:5432/mydatabase  # Connection URL for PostgreSQL
    networks:
      - my_network  # Connect to the custom network

  # PostgreSQL database service
  db:
    image: postgres:13  # Use the official PostgreSQL image
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
      POSTGRES_DB: mydatabase
    ports:
      - "5432:5432"  # Map host port 5432 to container port 5432
    networks:
      - my_network  # Connect to the custom network

networks:
  my_network:
    driver: bridge