picopaper/Dockerfile

41 lines
1.6 KiB
Docker

FROM ubuntu:24.04
# Install Python and pip
RUN apt-get update && \
apt-get install -y python3 python3-pip python3-venv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt /tmp/requirements.txt
# Install Python dependencies
RUN python3 -m pip install --no-cache-dir -r /tmp/requirements.txt --break-system-packages
# Copy Python script to /usr/local/bin so it survives volume mounts
COPY picopaper.py /usr/local/bin/picopaper.py
# Bake the default blog content into the image. The `new` command copies these
# into the working directory to scaffold a fresh blog without cloning the repo.
# Only user content is included — not picopaper.py/requirements.txt/.gitignore.
ENV PICOPAPER_SKELETON=/usr/local/share/picopaper/skeleton
COPY config.py /usr/local/share/picopaper/skeleton/
COPY theme/ /usr/local/share/picopaper/skeleton/theme/
COPY items/ /usr/local/share/picopaper/skeleton/items/
COPY images/ /usr/local/share/picopaper/skeleton/images/
COPY static/ /usr/local/share/picopaper/skeleton/static/
# Set working directory
WORKDIR /app
# Add /app to Python path so it can find config.py from mounted volume
ENV PYTHONPATH=/app
# Run as root to allow writing to mounted volumes
# (The mounted volume will have host user permissions)
# With no command the site is generated; pass `new` to scaffold a blog instead:
# podman run ... picopaper:latest -> build the site (default)
# podman run ... picopaper:latest new -> create a new blog in the current dir
ENTRYPOINT ["python3", "/usr/local/bin/picopaper.py"]
CMD []