diff --git a/Dockerfile b/Dockerfile index 75f2ef8..b6b4212 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" \