Skip to content
Open
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
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
make \
git \
&& rm -rf /var/lib/apt/lists/*

# Set the working directory in the container
WORKDIR /app

# Copy the file containing the requirements/setup first to leverage Docker cache
COPY setup.cfg setup.py README.md README.rst ./

# Install python dependencies including docs extras
# We use --editable to allow volume mounting to work effectively for code updates if needed,
# though mainly we are just building docs.
# If just for docs, editable might not be strictly necessary but it's consistent with dev setup.
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --editable ".[docs]"

# Copy the rest of the application code
COPY . .

# Expose the port that sphinx-autobuild will run on
EXPOSE 8000

# Default command to serve the documentation with live-reload
CMD ["sphinx-autobuild", "docs/source", "docs/build/html", "--host", "0.0.0.0", "--port", "8000"]
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ Knowing where a software package comes from, what its license is and whether it

> [!TIP]
> To manually build the documentation, run `make docs` from the root of this repo.
>
> Alternatively, you can use Docker to build and serve the documentation with live-reload:
> ```bash
> docker-compose up
> ```
> The documentation will be available at http://localhost:8000.

## Contributing

Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.8'

services:
docs:
build: .
volumes:
- .:/app
ports:
- "8000:8000"
command: sphinx-autobuild docs/source docs/build/html --host 0.0.0.0 --port 8000