Skip to content

Instantly share code, notes, and snippets.

@SealtielFreak
Last active September 20, 2024 21:32
Show Gist options
  • Save SealtielFreak/c256e1474752a81d8416bd82d5f48cc0 to your computer and use it in GitHub Desktop.
Save SealtielFreak/c256e1474752a81d8416bd82d5f48cc0 to your computer and use it in GitHub Desktop.
This Docker Compose configuration sets up a development environment with two interconnected containers: one for a FastAPI application and another for a Neo4j database. The FastAPI container serves as the backend application, while the Neo4j container provides the graph database service. Both containers are connected via a custom Docker network t…
DB_NAME=neo4j
DB_USERNAME=neo4j
DB_PASSWORD=my-secret-password
DB_PORT=7687
DB_HOST=graph-db
DB_URL="bolt://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}"
services:
api:
build: .
container_name: web-api
hostname: web-api
image: web-api:latest
restart: always
ports:
- "8000:80"
volumes:
- .:/app
- .:/docs
depends_on:
- db
networks:
- net
db:
container_name: graph-db
hostname: graph-db
image: neo4j:latest
restart: always
ports:
- "7474:7474"
- "7473:7473"
- "7687:7687"
expose:
- 7474
- 7687
environment:
- NEO4J_ACCEPT_LICENSE_AGREEMENT=yes
- NEO4J_AUTH=${DB_USERNAME}/${DB_PASSWORD}
- NEO4J_apoc_export_file_enabled=true
- NEO4J_apoc_import_file_enabled=true
- NEO4J_apoc_import_file_use__neo4j__config=true
- dbms.connector.bolt.listen_address=:7687
- dbms.connector.bolt.advertised_address=:7687
volumes:
- .:/db_data/data:/data
- .:/db_data/logs:/logs
- .:/db_data/import:/var/lib/neo4j/import
- .:/db_data/plugins:/plugins
networks:
- net
volumes:
db_data:
docs:
networks:
net:
driver: bridge
FROM python:3.12
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY /app .
EXPOSE 80
ENTRYPOINT ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80", "--reload"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment