Add Go demo with isolated CI and manual production release
Demo CI / check (push) Successful in 2m10s

This commit is contained in:
demo-ci committed 2026-10-09 00:45:47 +00:00
commit c65b5470e0
19 files changed
+398

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
FROM docker.io/library/golang:1.25.14-bookworm@sha256:c268a04d59aea0b180ed9946a658cfab9e7b3391dc90eed6e4969ccff98c851f AS build
ENV GOTOOLCHAIN=local CGO_ENABLED=0
WORKDIR /src
COPY src/go.mod ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY src/ ./
RUN --mount=type=cache,target=/root/.cache/go-build \
test -z "$(gofmt -l .)" \
&& go test ./... \
&& go vet ./... \
&& go build -trimpath -ldflags='-s -w' -o /out/demo .
FROM scratch AS runtime
ARG SOURCE_REVISION
LABEL org.opencontainers.image.source="https://git.dever.cc/rabin/demo" \
org.opencontainers.image.revision=$SOURCE_REVISION
COPY --from=build /out/demo /demo
USER 65532:65532
ENV PORT=8080
EXPOSE 8080
ENTRYPOINT ["/demo"]