~ajhalili2006's personal website, built with Zensical (successor of Material for Mkdocs) [old repo name got bugged while attempting to do manual knot migration via repo deletion]
andreijiroh.dev
zensical
mkdocs-material
website
1# syntax=docker/dockerfile:1
2FROM python:3.12-alpine AS buildkit
3# Instead of using Alpine base image and then installing Python from pkgs.al.o,
4# we'll go with the official images instead.
5
6# Since hadolint isn't in the package repos for Alpine yet, we'll copying from the offical
7# Docker image instead.
8COPY --from=ghcr.io/hadolint/hadolint:latest-alpine /bin/hadolint /usr/bin/hadolint
9
10# Copy build artifacts from official node image into here
11ENV YARN_VERSION 1.22.22
12COPY --from=node:20-alpine /opt/yarn-v$YARN_VERSION/bin/ /usr/local/bin/
13COPY --from=node:20-alpine /usr/local/bin/node /usr/local/bin/node
14COPY --from=node:20-alpine /usr/lib/node_modules/ /usr/lib/node_modules/
15
16ENV PACKAGES=/usr/local/lib/python3.11/site-packages PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin PYTHONDONTWRITEBYTECODE=1
17LABEL org.opencontainers.image.description="GitLab CI image for custom mkdocs-material Docker image, alongside tools @ajhalili2006 use."
18
19# https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards/#linux but for Alpine
20# Also installs Doppler CLI for accessing secrets securely within CI
21# hadolint ignore=DL3018,DL3013
22RUN apk add --no-cache \
23 cairo-dev \
24 freetype-dev \
25 libffi-dev \
26 jpeg-dev \
27 libpng-dev \
28 zlib-dev \
29 bash \
30 coreutils \
31 shellcheck \
32 gcc \
33 libffi-dev \
34 musl-dev \
35 git \
36 git-email \
37 git-lfs \
38 git-fast-import \
39 openssh \
40 gnupg \
41 curl \
42 rsync \
43 && curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh \
44 | sh
45
46# See https://www.jeffgeerling.com/blog/2023/how-solve-error-externally-managed-environment-when-installing-pip3
47# for context behind removing the EXTERNALLY-MANAGED file on distribution-built CPython binary releases
48RUN pip install --no-cache \
49 mkdocs-material \
50 mkdocs-git-committers-plugin-2 \
51 mkdocs-git-revision-date-localized-plugin \
52 mkdocs-minify-plugin \
53 mkdocs-redirects \
54 mkdocs-rss-plugin \
55 pillow \
56 cairosvg \
57 pipenv \
58 pipx \
59 && npm install -g corepack \
60 && corepack enable
61
62# Trust directory, required for git >= 2.35.2
63# Follows the docs for the Docker-based site build setup
64RUN git config --global --add safe.directory /docs &&\
65 git config --global --add safe.directory /site
66
67# Expose MkDocs development server port
68EXPOSE 8000
69
70WORKDIR /docs
71
72#COPY entrypoint.sh /usr/local/bin/entrypoint
73CMD [ "mkdocs", "serve", "--dev-addr=0.0.0.0:8000" ]