1
0
mirror of https://github.com/privacyguides/privacyguides.org.git synced 2025-07-02 01:32:41 +00:00
Files
privacyguides.org/Dockerfile

70 lines
2.0 KiB
Docker
Raw Normal View History

FROM python:3.12-bookworm AS base
2024-04-05 14:47:56 -05:00
LABEL org.opencontainers.image.source="https://github.com/privacyguides/privacyguides.org"
# Setup environment
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONFAULTHANDLER=1
2024-04-05 14:47:56 -05:00
####################################################
# Stage: python-deps
# Install pipenv and compilation dependencies
####################################################
2024-04-05 14:47:56 -05:00
FROM base AS python-deps
# Install pipenv
RUN pip install --no-cache-dir pipenv
# Install build tools and libraries needed to compile any Python packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
gcc \
libffi-dev \
build-essential \
&& rm -rf /var/lib/apt/lists/*
2024-04-05 14:47:56 -05:00
# Copy Pipfile, Pipfile.lock, and any local modules needed for dependency resolution
2024-04-05 14:47:56 -05:00
COPY modules/mkdocs-material ./modules/mkdocs-material
COPY Pipfile .
COPY Pipfile.lock .
# Install all Python dependencies into a projectlocal virtual environment at /.venv
2024-04-05 14:47:56 -05:00
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
####################################################
# Stage: runtime
# Install runtime dependencies and copy runtime artifacts
####################################################
2024-04-05 14:47:56 -05:00
FROM base AS runtime
# Install runtime packages (GTK/Cairo, image processing libraries, Git, etc.)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libcairo2-dev \
libfreetype6-dev \
git \
libjpeg-dev \
libpng-dev \
openssh-client \
pngquant \
tini \
zlib1g-dev \
libffi-dev \
bash \
caddy \
&& rm -rf /var/lib/apt/lists/*
2024-04-05 14:47:56 -05:00
# Copy virtual environment and local mkdocs-material module from python-deps stage
2024-04-05 14:47:56 -05:00
COPY --from=python-deps /.venv /.venv
COPY --from=python-deps /modules/mkdocs-material /modules/mkdocs-material
# Ensure the virtual environments bin directory is first in PATH
ENV PATH="/.venv/bin:$PATH"
2024-04-05 14:47:56 -05:00
HEALTHCHECK NONE
# Entry point script and default cmd for running mkdocs
ENTRYPOINT ["/bin/bash"]