Updated Dockerfile
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
This commit is contained in:
@@ -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" \
|
||||
|
||||
Reference in New Issue
Block a user