Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,13 @@ jobs:
done
docker logs smoke
exit 1
# An orphan is reparented to the container's PID 1; without an init that
# reaps, it stays a zombie (git leaves such orphans after every fetch).
- name: Check orphaned processes are reaped
run: |
docker exec smoke sh -c 'sleep 1 & exit'
sleep 3
if docker exec smoke ps -o stat | grep -q '^Z'; then
docker exec smoke ps -o pid,ppid,stat,args
exit 1
fi
9 changes: 7 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ RUN cargo build --release --locked --bin git-cache-proxy
FROM alpine:3.24
# The cache root is created owned by the runtime user so the image works as
# non-root on runtimes with no fsGroup equivalent (Docker, ECS).
RUN apk add --no-cache git ca-certificates \
# tini is PID 1: git leaves orphans (detached auto maintenance, descendants of a
# killed process group) that only PID 1 can reap, and the proxy does not.
RUN apk add --no-cache git ca-certificates tini \
&& rm -rf /var/cache/apk/* \
&& addgroup -S -g 10001 gitcache \
&& adduser -S -D -u 10001 -G gitcache gitcache \
Expand All @@ -26,4 +28,7 @@ VOLUME /var/cache/git-cache-proxy
EXPOSE 8080
# Numeric, so Kubernetes `runAsNonRoot` can verify it.
USER 10001:10001
ENTRYPOINT ["/usr/local/bin/git-cache-proxy"]
# Under another init (`docker run --init`, a shared Kubernetes PID namespace)
# tini is not PID 1; as a subreaper it still reaps instead of only warning.
ENV TINI_SUBREAPER=1
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/git-cache-proxy"]
Loading