~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
6ENV 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
7LABEL org.opencontainers.image.description="GitLab CI image for a custom mkdocs-material Docker image, alongside tools @ajhalili2006 use."
8
9# Since hadolint isn't in the package repos for Alpine yet, we'll copying from the offical
10# Docker image instead.
11COPY --from=ghcr.io/hadolint/hadolint:latest-alpine /bin/hadolint /usr/bin/hadolint
12
13# https://squidfunk.github.io/mkdocs-material/setup/setting-up-social-cards/#linux but for Alpine
14# Also installs Doppler CLI for accessing secrets securely within CI
15# hadolint ignore=DL3018,DL3013
16RUN apk add --no-cache \
17 cairo-dev \
18 freetype-dev \
19 libffi-dev \
20 jpeg-dev \
21 libpng-dev \
22 zlib-dev \
23 bash \
24 coreutils \
25 shellcheck \
26 gcc \
27 libffi-dev \
28 musl-dev \
29 git \
30 git-email \
31 git-lfs \
32 git-fast-import \
33 openssh \
34 gnupg \
35 curl \
36 wget \
37 rsync \
38 libstdc++ \
39 && curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh \
40 | sh -s --debug
41
42# Copy build artifacts from official node image into here
43ENV YARN_VERSION 1.22.22
44COPY --from=node:20-alpine /opt/yarn-v$YARN_VERSION /opt/yarn-v$YARN_VERSION
45COPY --from=node:20-alpine /usr/local/bin/node /usr/local/bin/node
46COPY --from=node:20-alpine /usr/local/lib/node_modules/ /usr/local/lib/node_modules/
47COPY --from=node:20-alpine /usr/local/include/node/ /usr/local/include/node/
48
49RUN ln -s /usr/local/bin/node /usr/local/bin/nodejs \
50 && ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
51 && ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
52 && ln -s /usr/local/lib/node_modules/corepack/dist/corepack.js /usr/local/bin/corepack \
53 && ln -s /opt/yarn-v$YARN_VERSION/bin/yarn /usr/local/bin/yarn \
54 && corepack enable
55
56# See https://www.jeffgeerling.com/blog/2023/how-solve-error-externally-managed-environment-when-installing-pip3
57# for context behind removing the EXTERNALLY-MANAGED file on distribution-built CPython binary releases.
58# Since we're using the official Python Docker image, we don't need to worry about that.
59RUN pip install --no-cache \
60 mkdocs-material \
61 mkdocs-git-committers-plugin-2 \
62 mkdocs-git-revision-date-localized-plugin \
63 mkdocs-minify-plugin \
64 mkdocs-redirects \
65 mkdocs-rss-plugin \
66 pillow \
67 cairosvg \
68 pipenv \
69 pipx
70
71# Trust directory, required for git >= 2.35.2
72# Follows the docs for the Docker-based site build setup
73RUN git config --global --add safe.directory /docs &&\
74 git config --global --add safe.directory /site
75
76# Expose MkDocs development server port
77EXPOSE 8000
78
79WORKDIR /docs
80
81#COPY entrypoint.sh /usr/local/bin/entrypoint
82CMD [ "mkdocs", "serve", "--dev-addr=0.0.0.0:8000" ]