Updated Dockerfile
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful

This commit is contained in:
2026-03-19 21:38:29 -05:00
parent 312e738b25
commit 6e8adcc9cc

View File

@@ -23,9 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Cache dependencies first
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
if [ -n "${GITEA_USER}" ] && [ -n "${GITEA_TOKEN}" ]; then \
git config --global url."https://${GITEA_USER}:${GITEA_TOKEN}@gitea.maximumdirect.net/".insteadOf "https://gitea.maximumdirect.net/"; \
fi && \
git config --global url."https://${GITEA_USER}:${GITEA_TOKEN}@gitea.maximumdirect.net/".insteadOf "https://gitea.maximumdirect.net/" && \
go mod download && go mod verify && \
rm -f /root/.gitconfig
@@ -44,11 +42,13 @@ ENV CGO_ENABLED=${CGO_ENABLED} \
# Run tests before building the final binary
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
git config --global url."https://${GITEA_USER}:${GITEA_TOKEN}@gitea.maximumdirect.net/".insteadOf "https://gitea.maximumdirect.net/" && \
go test ./...
# Build the cmd entrypoint
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
git config --global url."https://${GITEA_USER}:${GITEA_TOKEN}@gitea.maximumdirect.net/".insteadOf "https://gitea.maximumdirect.net/" && \
go build \
-trimpath \
-ldflags="-s -w" \