forked from privacyguides/privacyguides.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
84 lines (67 loc) · 2.55 KB
/
Dockerfile
File metadata and controls
84 lines (67 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
FROM python:3.12-slim-bookworm AS base
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
####################################################
# Stage: python-deps
# Install pipenv and compilation dependencies
####################################################
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/*
# Copy Pipfile, Pipfile.lock, and any local modules needed for dependency resolution
COPY modules/mkdocs-material ./modules/mkdocs-material
COPY Pipfile .
COPY Pipfile.lock .
# Install all Python dependencies into a project‐local virtual environment at /.venv
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
####################################################
# Stage: nodejs-deps
# Install nodejs/npm and compilation dependencies
####################################################
FROM node:24-bookworm-slim AS nodejs-deps
RUN npm i -g all-contributors-cli
RUN npm install -g pkg
RUN cd /usr/local/lib/node_modules/all-contributors-cli && \
pkg dist/cli.js -t node18-linux -o /usr/local/bin/all-contributors-cli
####################################################
# Stage: runtime
# Install runtime dependencies and copy runtime artifacts
####################################################
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/*
# Copy virtual environment and local mkdocs-material module from python-deps stage
COPY --from=python-deps /.venv /.venv
COPY --from=python-deps /modules/mkdocs-material /modules/mkdocs-material
# Copy all-contributors-cli from nodejs-deps stage
COPY --from=nodejs-deps /usr/local/bin/all-contributors-cli /usr/local/bin/all-contributors-cli
# Ensure the virtual environment’s bin directory is first in PATH
ENV PATH="/.venv/bin:$PATH"
HEALTHCHECK NONE
# Entry point script and default cmd for running mkdocs
ENTRYPOINT ["/bin/bash"]