fastapi-fastapi
SUCCESS
3m 36s
History Source
SummaryIterations1Transcript3Dockerfile
Dockerfile34 lines · 1276 chars
FROM python:3.15.0a7-slim

# Basic non-interactive frontend
ENV DEBIAN_FRONTEND=noninteractive

# System dependencies (for docs tooling and git access)
RUN apt-get update \
    && apt-get install -y --no-install-recommends ca-certificates git \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /code

# Cache-friendly copy: bring in pyproject and uv.lock first for dependency resolution
COPY pyproject.toml uv.lock /code/

# Install the docs tool 'uv' used by the build workflow
RUN python3 -m pip install --no-cache-dir uv

# Copy the rest of the repository
COPY . /code

# Install docs dependencies and prepare the docs workspace
RUN uv sync --locked --no-dev --group docs

# Update and build docs languages (best-effort; languages may vary)
RUN uv run ./scripts/docs.py update-languages || true
RUN uv run ./scripts/docs.py build-lang en || true

# Expose a port to serve the built site
EXPOSE 8080

# Serve the generated docs (prefer site/en if available, otherwise site). If nothing built yet, keep container alive.
CMD ["/bin/sh", "-c", "set -e; if [ -d site/en ]; then cd site/en; python3 -m http.server 8080 --bind 0.0.0.0; elif [ -d site ]; then cd site; python3 -m http.server 8080 --bind 0.0.0.0; else echo 'Site not built yet'; tail -f /dev/null; fi"]