Files
gitea-mcp/Dockerfile
appleboy 57ec13dffd
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 10s
check-and-test / Run govulncheck (pull_request) Successful in 14s
build: streamline container configuration and metadata
- Remove the container healthcheck definition - Delete the image authors label from the build Signed-off-by: appleboy <appleboy.tw@gmail.com>
2025-05-30 14:47:02 +08:00

35 lines
771 B
Docker

# syntax=docker/dockerfile:1.4
# Build stage
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
ARG VERSION=dev
ARG TARGETOS
ARG TARGETARCH
WORKDIR /app
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} \
go build -trimpath -ldflags="-s -w -X main.Version=${VERSION}" -o gitea-mcp
# Final stage
FROM gcr.io/distroless/static-debian11:nonroot
ENV GITEA_MODE=stdio
WORKDIR /app
COPY --from=builder --chown=nonroot:nonroot /app/gitea-mcp .
USER nonroot:nonroot
LABEL org.opencontainers.image.version="${VERSION}"
CMD ["/app/gitea-mcp"]