Skip to content

Commit 7a5fb76

Browse files
committed
#510 add comments to Dockerfile
1 parent 2fd71a5 commit 7a5fb76

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

Dockerfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM ghcr.io/prefix-dev/pixi:0.72.2-noble AS build
2+
# Inspired by https://tech.quantco.com/blog/pixi-production/
23

34
# ARGS
45
ARG LANGUAGE="en_US"
@@ -8,21 +9,27 @@ ENV LOCALE_STR="${LANGUAGE}.${ENCODING} ${ENCODING}" \
89
DEBIAN_FRONTEND=noninteractive
910

1011
# Install and Configure default locale
11-
# NB GHC has its own language handlling via Babel.
12+
# NB GHC has its own language handling via Babel.
1213
RUN apt update -y \
1314
&& apt install -y locales \
1415
&& echo "${LOCALE_STR}" > /etc/locale.gen \
1516
&& locale-gen \
1617
&& rm -rf /var/lib/apt/lists/*
1718

19+
# Copy entire GHC repo content to /app
1820
WORKDIR /app
1921
COPY . .
2022

23+
# Install deps (in /app/.pixi/).
2124
RUN pixi install -e prod --locked
25+
26+
# pixi-env.sh: to be sourced, sets all paths and more.
2227
RUN echo '#!/bin/bash' > /app/pixi-env.sh
2328
RUN pixi shell-hook -e prod -s bash --as-is >> /app/pixi-env.sh
2429
RUN echo 'exec "$@"' >> /app/pixi-env.sh
2530
RUN echo chmod +x /app/pixi-env.sh
31+
32+
# Prepare the GHC app, mainly web-related.
2633
RUN pixi run -e prod setup
2734
RUN cp docker/config_site.py instance/
2835
RUN if [ -d docker/plugins ]; then cp -ar docker/plugins/* /app/GeoHealthCheck/plugins/; fi
@@ -45,8 +52,6 @@ COPY --from=build /etc/default/locale /etc/default/locale
4552

4653
# These are default values,
4754
# Override when running container via docker(-compose)
48-
49-
# General ENV settings
5055
ENV LANG='en_US.UTF-8' \
5156
LANGUAGE='en_US:en' \
5257
LC_ALL='en_US.UTF-8' \
@@ -106,7 +111,7 @@ ENV LANG='en_US.UTF-8' \
106111

107112
# GHC User Plugins, best be overridden via Container environment \
108113

109-
# Install operating system dependencies
114+
# Install remaining dependencies and create user.
110115
RUN \
111116
apt update \
112117
&& apt --no-install-recommends install -y ${DEB_PACKAGES} ${DEB_BUILD_DEPS} \
@@ -117,10 +122,11 @@ RUN \
117122
&& apt autoremove -y \
118123
&& rm -rf /var/lib/apt/lists/*
119124

125+
# Copy entire bundle: GHC plus all dependencies, including non-Python binaries in /app.
120126
WORKDIR /app
121127
COPY --from=build --chown=${GHC_USER}:${GHC_USER} /app /app
122128

123-
# For later: run as user 'ghc'
129+
# Run Containers as user.
124130
USER ${GHC_USER}
125131

126132
EXPOSE ${PORT}

0 commit comments

Comments
 (0)