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
|
# Cache dependencies first
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
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/" && \
|
||||||
git config --global url."https://${GITEA_USER}:${GITEA_TOKEN}@gitea.maximumdirect.net/".insteadOf "https://gitea.maximumdirect.net/"; \
|
|
||||||
fi && \
|
|
||||||
go mod download && go mod verify && \
|
go mod download && go mod verify && \
|
||||||
rm -f /root/.gitconfig
|
rm -f /root/.gitconfig
|
||||||
|
|
||||||
@@ -44,11 +42,13 @@ ENV CGO_ENABLED=${CGO_ENABLED} \
|
|||||||
# Run tests before building the final binary
|
# Run tests before building the final binary
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
--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 ./...
|
go test ./...
|
||||||
|
|
||||||
# Build the cmd entrypoint
|
# Build the cmd entrypoint
|
||||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
--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 \
|
go build \
|
||||||
-trimpath \
|
-trimpath \
|
||||||
-ldflags="-s -w" \
|
-ldflags="-s -w" \
|
||||||
|
|||||||
Reference in New Issue
Block a user