feat(docker): configure static git identity

This commit is contained in:
Devvyn
2026-09-25 22:25:11 +08:00
parent 5ae574374f
commit 8d358aaa26
8 changed files with 149 additions and 2 deletions
+14
View File
@@ -25,6 +25,8 @@ RUN npm ci \
FROM node:22-bookworm-slim
ARG CODEMAN_RUNTIME_USER=codeman
ARG GIT_USER_EMAIL=
ARG GIT_USER_NAME=
ARG PUID=1000
ARG PGID=1000
@@ -48,6 +50,18 @@ RUN apt-get update \
tmux \
&& rm -rf /var/lib/apt/lists/*
# A runtime home is normally a bind mount, so user-level Git configuration is
# not durable across a fresh deployment. Keep the operator-supplied identity in
# the image's system config instead. Both values are required together to avoid
# producing commits with a misleading partial identity.
RUN set -eux; \
if [ -n "${GIT_USER_NAME}" ] || [ -n "${GIT_USER_EMAIL}" ]; then \
test -n "${GIT_USER_NAME}"; \
test -n "${GIT_USER_EMAIL}"; \
git config --system user.name "${GIT_USER_NAME}"; \
git config --system user.email "${GIT_USER_EMAIL}"; \
fi
# The Docker CLI, taken from the official image rather than Debian's `docker.io`.
# That package is the full ENGINE: with --no-install-recommends it still pulls 15
# packages including containerd, runc, dmsetup and iptables, none of which a