Skip to content

Commit

Permalink
configured docker compose (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzzz-coding committed Aug 16, 2024
1 parent 611fe41 commit 437dd53
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion backend/backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
'NAME': 'yourdatabase',
'USER': 'yourusername',
'PASSWORD': 'yourpassword',
'HOST': 'localhost',
'HOST': 'db',
'PORT': '5432'
}
}
Expand Down
27 changes: 17 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.9" # Use the version of Docker Compose that you need

services:
db:
image: postgres # Use the latest PostgreSQL image
image: postgres:12 # Use the latest PostgreSQL image
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
Expand All @@ -11,12 +11,19 @@ services:
- POSTGRES_DB=yourdatabase # Set the name of the database
ports:
- "5432:5432" # Map the PostgreSQL port to the host
# backend:
# build: ./backend
# command: python manage.py runserver 0.0.0.0:8000
# volumes:
# - ./backend:/app
# ports:
# - "8000:8000"
# depends_on:
# - db
healthcheck:
test: ["CMD-SHELL", "pg_isready -U yourusername -d yourdatabase"]
interval: 10s
timeout: 5s
retries: 5
backend:
build: ./backend
command: python manage.py runserver 0.0.0.0:8000
restart: on-failure:10
volumes:
- .:/code
ports:
- "8000:8000"
depends_on:
db:
condition: service_healthy

0 comments on commit 437dd53

Please sign in to comment.