Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ To enables/configures ci, create repository variables and secrets as needed:
- Start services (production):

```bash
docker compose -f docker/docker-compose.yml up --build
just compose-deploy
```

- Start services for development (mounts project and enables hot reload):
Expand Down
8 changes: 5 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM python:3.12-slim
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

# use aliyun mirror if you need it
RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources

RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc libpq-dev build-essential postgresql-client \
&& rm -rf /var/lib/apt/lists/*
Expand All @@ -12,8 +15,7 @@ WORKDIR /app
# copy repository into image. .dockerignore will exclude tests, docs and other dev files
COPY . .

RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install --no-cache-dir .
RUN uv pip install --system --no-cache .

EXPOSE 8000

Expand Down
2 changes: 0 additions & 2 deletions docker/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

services:
app:
# Development overrides: mount project root and enable hot reload
Expand Down
15 changes: 11 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
version: '3.9'

services:
app:
build:
context: ..
dockerfile: docker/Dockerfile
pull: true
image: fastapi-boilerplate:latest
env_file:
- ../.env
ports:
- "8000:8000"
restart: unless-stopped
depends_on:
- db
- redis
db:
condition: service_healthy
redis:
condition: service_healthy

db:
image: postgres:15-alpine
Expand All @@ -35,6 +37,11 @@ services:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5

volumes:
postgres_data:
Expand Down
3 changes: 3 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ run port=PORT:
@benchmark:
uv run locust -f tests/locustfile.py

@compose-deploy:
docker compose -f docker/docker-compose.yml up -d --build

# Generate database migration
@db-migrate message:
uv run alembic revision --autogenerate -m "{{message}}"
Expand Down
Loading