mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
ffd9e8c187
- Add WeasyPrint dependency and system libs to Docker image
- Create PDF templates for adult and kids stories
- Add /stories/{slug}/pdf and /stories/{slug}/kids/pdf routes
- Add Download PDF button to story pages
- Add stories API endpoints: /api/stories and /api/stories/{slug}
- Gracefully handle missing WeasyPrint system libraries
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.1 KiB
Docker
48 lines
1.1 KiB
Docker
FROM python:3.13 AS builder
|
|
|
|
# Install uv
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
UV_COMPILE_BYTECODE=1 \
|
|
UV_LINK_MODE=copy
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy dependency files
|
|
COPY pyproject.toml uv.lock ./
|
|
|
|
# Install dependencies into the system
|
|
RUN uv sync --frozen --no-install-project --no-dev
|
|
|
|
FROM python:3.13-slim
|
|
|
|
# Install uv
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
|
|
|
# Install WeasyPrint system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
libpango1.0-0 \
|
|
libpangocairo-1.0-0 \
|
|
libgdk-pixbuf-2.0-0 \
|
|
libffi8 \
|
|
shared-mime-info \
|
|
fonts-dejavu-core \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONPATH="/app" \
|
|
PATH="/app/.venv/bin:$PATH"
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy virtual environment from builder stage
|
|
COPY --from=builder /app/.venv /app/.venv
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Run the application using uvicorn directly
|
|
CMD ["uvicorn", "kjvstudy_org.server:app", "--host", "0.0.0.0", "--port", "8000"] |