Make the image prepare its own data directory (closes #262)
check / check (push) Failing after 1m19s

A host directory mounted at /var/lib/neoirc kept the host's owner, so
neoircd could not create state.db. The image now starts as root in
deploy/docker-entrypoint.sh, which creates /var/lib/neoirc, gives it to
neoirc with mode 0700, and runs neoircd as neoirc through su-exec.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-10 20:02:34 +00:00
1 parent bc8aa6bb96
commit b3ecefe49d
3 files changed
+34 -8

No files matched your search

+7 -6
View File
@@ -83,14 +83,15 @@ RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /neoirc-cli ./cmd/neoir
# stage's chain and nothing else.
# alpine:3.21, 2026-02-26
FROM alpine@sha256:c3f8e73fdb79deaebaa2037150150191b9dcbfba68b4a46d70103204c53f4709
RUN apk add --no-cache ca-certificates \
&& addgroup -S neoirc && adduser -S neoirc -G neoirc \
&& mkdir -p /var/lib/neoirc \
&& chown neoirc:neoirc /var/lib/neoirc
# su-exec 0.2-r3, 2026-11-10
RUN apk add --no-cache ca-certificates su-exec=0.2-r3 \
&& addgroup -S neoirc && adduser -S neoirc -G neoirc
COPY --from=builder /neoircd /usr/local/bin/neoircd
COPY deploy/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
USER neoirc
# No USER: the entrypoint starts as root to give /var/lib/neoirc to neoirc,
# then runs neoircd as neoirc.
EXPOSE 8080 6667
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost:8080/.well-known/healthcheck.json || exit 1
ENTRYPOINT ["neoircd"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]