-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.jenkins
27 lines (22 loc) · 923 Bytes
/
Dockerfile.jenkins
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# syntax=docker/dockerfile:1
ARG ALPINE_VERSION=3.18
ARG GO_VERSION=1.21
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
RUN apk update && apk add --no-cache ca-certificates busybox-static git tini-static
WORKDIR /build
COPY [ "go.mod", "go.sum", "./" ]
RUN go mod download
RUN go mod verify
COPY [ ".", "." ]
RUN go test ./...
ARG TARGETOS TARGETARCH
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags='-w -s' -o 'dist/terraform-version-inspect'
FROM scratch
COPY --from=builder [ "/bin/busybox.static", "/bin/cat" ]
COPY --from=builder [ "/sbin/tini-static", "/bin/tini" ]
COPY --from=builder [ "/etc/ssl/certs/ca-certificates.crt", "/etc/ssl/certs/" ]
COPY --from=builder [ "/build/dist/terraform-version-inspect", "/bin/terraform-version-inspect" ]
ENV PATH=/bin
WORKDIR /mnt
ENTRYPOINT [ "tini", "-g", "--" ]
CMD [ "terraform-version-inspect", "--help" ]