Files
simplegit/Dockerfile
T

40 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1
#
# simplegit — git hosting (SSH + HTTP) + management API (SQLite, CGO).
#
# Runtime: simplegit shells out to system `git` (git http-backend,
# receive-pack, ...), so the runtime image installs git. Identity + JWT signing
# are absorbed into simplegit (no separate simpleauth service / sibling module),
# so the build context only needs this module.
#
# Web console is NOT bundled.
# docker build -f pkgs/simplegit/Dockerfile -t gasoline/simplegit:latest pkgs/
FROM golang:1.26 AS build
ENV CGO_ENABLED=1 GOFLAGS=-trimpath \
GOPROXY=https://goproxy.cn,direct GOSUMDB=off
WORKDIR /src
# Copy the module manifest first so `go mod download` is cacheable.
COPY simplegit/go.mod simplegit/go.sum ./simplegit/
WORKDIR /src/simplegit
RUN go mod download
COPY simplegit/ ./simplegit/
RUN go build -o /out/simplegit ./cmd
FROM debian:bookworm-slim
# git is a hard runtime dependency (simplegit execs git for all repo ops).
RUN apt-get update \
&& apt-get install -y --no-install-recommends git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=build /out/simplegit /app/simplegit
COPY simplegit/hook.sh /app/hook.sh
EXPOSE 8080 2222
ENTRYPOINT ["/app/simplegit"]
# Identity/JWT are verified in-process; no -auth-url. The Ed25519 signing key
# is auto-created under <root>/signing.key if absent.
CMD ["-ssh", ":2222", "-http", ":8080", "-root", "/data"]