Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.git
.github
.vscode
.venv
.uv-cache
.mypy_cache
.ruff_cache
.pytest_cache
__pycache__
*.pyc
*.pyo
*.pyd
*.db
*.sqlite3
.env
db/schema.sql
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add another dockerfile tht run the migration on postgress in the staging or do it in this dockerfile

WORKDIR /app

RUN pip install --no-cache-dir uv

COPY pyproject.toml uv.lock ./
RUN uv sync --locked --no-dev

COPY . .

EXPOSE 8000

CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
32 changes: 24 additions & 8 deletions docker-compose.yml

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

create env for staging tht have the hosts of staging network (instead of local host we use service name ) and sone touch the .env we let it for the dev environement

Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
version: "3.9"

services:

postgres:
image: pgvector/pgvector:pg16
container_name: multi_postgres
Expand All @@ -13,7 +10,7 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- "${POSTGRES_PORT}:5432"
- "${POSTGRES_PORT}:5432"

volumes:
- postgres_data:/var/lib/postgresql/data
Expand All @@ -27,6 +24,8 @@ services:
-js
-a 0.0.0.0
-m ${NATS_MONITOR_PORT}
--user ${NATS_USER}
--pass ${NATS_PASSWORD}
ports:
- "${NATS_PORT}:4222"
- "${NATS_MONITOR_PORT}:8222"
Expand Down Expand Up @@ -59,7 +58,7 @@ services:
- "${PGADMIN_PORT}:80"
networks:
- multi_network

redis:
image: redis:7-alpine
container_name: multi_redis
Expand All @@ -69,14 +68,31 @@ services:
networks:
- multi_network
volumes:
- redis_data:/data
- redis_data:/data

fastapi:
build:
context: .
dockerfile: Dockerfile
container_name: multi_fastapi
restart: unless-stopped
env_file:
- .env
depends_on:
- postgres
- redis
- nats
- minio
ports:
- "8000:8000"
networks:
- multi_network

volumes:
postgres_data:
minio_data:
redis_data:


networks:
multi_network:
driver: bridge
driver: bridge