Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions fastapi-postgres/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: '3.9'
services:

services:
postgres:
image: postgres:latest
container_name: postgres
Expand All @@ -9,26 +9,37 @@ services:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432" # Map the PostgreSQL port to the host machine
- "5432:5432"
volumes:
- postgres-data:/var/lib/postgresql/data
- ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- keploy-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5

app:
container_name: fastapi-app
image: fastapi
image: keploy/fastapi-app:latest
Copy link

@pratik-mahalle pratik-mahalle Aug 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it will be great, as there is no image name keploy/fastapi-app

build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
ports:
- 8000:8000
- "8000:8000"
depends_on:
- postgres
postgres:
condition: service_healthy
networks:
- keploy-network

volumes:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried it running on your local machine?

postgres-data:

networks:
keploy-network:
external: true
name: keploy-network
driver: bridge