Files
kennethreitz.org/Dockerfile
T
kennethreitz 6ac99803bf Upgrade to astral/uv image and fix docker-compose cache preservation
Updated Dockerfile to use official astral/uv:python3.13-bookworm base image instead of copying uv from separate image, simplifying build process. Fixed docker-compose.yml to preserve pre-built cache directory when mounting local files, ensuring instant startup works in both production and local development environments.

Changes:
- Use astral/uv:python3.13-bookworm as base image
- Remove multi-stage copy of uv binary
- Add cache volume preservation in docker-compose
- Maintain instant startup with pre-built caches in all environments

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-16 16:34:33 -04:00

25 lines
766 B
Docker

FROM astral/uv:python3.13-bookworm
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
UV_SYSTEM_PYTHON=1
WORKDIR /app
# Copy dependency files first
COPY pyproject.toml ./
# Install dependencies directly without creating a venv (since we're in a container)
RUN uv sync
# Copy the rest of the application
COPY . .
# Pre-build all caches during Docker build for instant startup
RUN echo "Pre-building caches during Docker build..." && \
uv run prebuild_cache.py && \
echo "Cache pre-build completed!"
# Run gunicorn directly (no need for uv run since we installed system-wide)
CMD ["uv", "run", "gunicorn", "--bind", "0.0.0.0:8000", "--worker-class", "gevent", "--workers", "1", "--worker-connections", "1000", "--timeout", "60", "engine:app"]