Dockerfile: add GO_SWAGGER_VERSION build-arg

Allow overriding the go-swagger version to install.

With this patch:

    docker build -q --call=outline --target=swagger .

    TARGET: swagger

    BUILD ARG            VALUE                    DESCRIPTION
    GO_VERSION           1.24.5
    BASE_DEBIAN_DISTRO   bookworm
    GOLANG_IMAGE         golang:1.24.5-bookworm
    XX_VERSION           1.6.1
    GO_SWAGGER_VERSION   v0.32.3                  specifies the version of the go-swagger binary to install.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-08-02 01:37:02 +02:00
parent 0f9c087c91
commit e7c784c270

View File

@@ -84,11 +84,15 @@ RUN mkdir /build && mv /bin/registry /build/registry
FROM base AS swagger
WORKDIR /go/src/github.com/go-swagger/go-swagger
ARG TARGETPLATFORM
# GO_SWAGGER_VERSION specifies the version of the go-swagger binary to install.
# Go-swagger is used in CI for generating types from swagger.yaml in
# hack/validate/swagger-gen
ARG GO_SWAGGER_VERSION=v0.32.3
RUN --mount=type=cache,target=/root/.cache/go-build,id=swagger-build-$TARGETPLATFORM \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=tmpfs,target=/go/src/ <<EOT
set -e
GOBIN=/build xx-go install github.com/go-swagger/go-swagger/cmd/swagger@v0.32.3
GOBIN=/build xx-go install "github.com/go-swagger/go-swagger/cmd/swagger@${GO_SWAGGER_VERSION}"
xx-verify /build/swagger
EOT