github.com/xgoffin/jenkins-library@v1.154.0/Dockerfile (about)

     1  FROM golang:1.17 AS build-env
     2  COPY . /build
     3  WORKDIR /build
     4  
     5  # execute tests
     6  RUN go test ./... -cover
     7  
     8  ## ONLY tests so far, building to be added later
     9  # execute build
    10  # with `-tags release` we ensure that shared test utilities won't end up in the binary
    11  RUN export GIT_COMMIT=$(git rev-parse HEAD) && \
    12      export GIT_REPOSITORY=$(git config --get remote.origin.url) && \
    13      CGO_ENABLED=0 go build \
    14          -ldflags \
    15              "-X github.com/SAP/jenkins-library/cmd.GitCommit=${GIT_COMMIT} \
    16              -X github.com/SAP/jenkins-library/pkg/log.LibraryRepository=${GIT_REPOSITORY} \
    17              -X github.com/SAP/jenkins-library/pkg/log.LibraryName=piper-lib-os \
    18              -X github.com/SAP/jenkins-library/pkg/telemetry.LibraryRepository=${GIT_REPOSITORY}" \
    19          -tags release \
    20          -o piper
    21  
    22  # FROM gcr.io/distroless/base:latest
    23  # COPY --from=build-env /build/piper /piper
    24  # ENTRYPOINT ["/piper"]