git-trace

romele / git-trace public

61 commits · 1 branch · 1 tag · last push 7m ago

Dockerfile

# git-trace — production image.  Two stages: build on alpine, run on
# a minimal rootfs with just git + sqlite + openssh.
#
#   docker build -t git-trace .
#   docker run -d -p 8081:8081 -p 2222:2222 \
#       -v gt-data:/srv/git-trace git-trace
#
# env: GIT_TRACE_NAME, GIT_TRACE_BASE_URL, GIT_TRACE_OPEN_REG,
#      GIT_TRACE_SSH_URL, GIT_TRACE_SSHD=0 (disable forge sshd)

FROM alpine:3.20 AS build
RUN apk add --no-cache build-base sqlite-dev
WORKDIR /src
COPY . .
RUN make

FROM alpine:3.20
RUN apk add --no-cache git sqlite-libs openssh-server su-exec tar \
 && adduser -D -h /srv/git-trace git
COPY --from=build /src/git-trace /usr/local/bin/git-trace
COPY deploy/sshd-forge.conf /etc/git-trace/sshd-forge.conf
COPY deploy/docker-entrypoint.sh /entrypoint.sh
# defaults so `docker exec <c> git-trace doctor|backup` sees the same
# paths as the daemon (docker exec does not inherit entrypoint exports)
ENV GIT_TRACE_HOME=/srv/git-trace \
    GIT_TRACE_REPOS=/srv/git-trace/repos \
    GIT_TRACE_DB=/srv/git-trace/var/git-trace.db \
    GIT_TRACE_SSH_URL=ssh://git@localhost:2222
EXPOSE 8081 2222
VOLUME /srv/git-trace
ENTRYPOINT ["/entrypoint.sh"]