|
1 | | - # STAGE 1 |
2 | | - FROM golang:1.13.4 as builder |
| 1 | +# STAGE 1 |
| 2 | +FROM golang:1.13.4 as builder |
3 | 3 |
|
4 | | - WORKDIR /go/github.com/jetstack/preflight |
| 4 | +WORKDIR /go/github.com/jetstack/preflight |
5 | 5 |
|
6 | | - # Run a dependency resolve with just the go mod files present for |
7 | | - # better caching |
8 | | - COPY ./go.mod . |
9 | | - COPY ./go.sum . |
| 6 | +# Run a dependency resolve with just the go mod files present for |
| 7 | +# better caching |
| 8 | +COPY ./go.mod . |
| 9 | +COPY ./go.sum . |
10 | 10 |
|
11 | | - RUN go mod download |
| 11 | +RUN go mod download |
12 | 12 |
|
13 | | - ## Bring in everything else and build an amd64 image |
14 | | - COPY . . |
15 | | - RUN GOOS=linux GOARCH=amd64 go install . |
| 13 | +## Bring in everything else and build an amd64 image |
| 14 | +COPY . . |
| 15 | +RUN GOOS=linux GOARCH=amd64 go install . |
16 | 16 |
|
17 | | - # STAGE 2 |
18 | | - # Use a distroless nonroot base image for just our executable |
19 | | - FROM gcr.io/distroless/base:nonroot |
20 | | - COPY --from=builder /go/bin/preflight /bin/preflight |
21 | | - ADD ./preflight-packages /preflight-packages |
22 | | - ADD ./examples/pods.preflight.yaml /etc/preflight/preflight.yaml |
23 | | - ENTRYPOINT ["preflight"] |
24 | | - CMD ["check", "--config-file", "/etc/preflight/preflight.yaml"] |
| 17 | +# STAGE 2 |
| 18 | +# Use a distroless nonroot base image for just our executable |
| 19 | +FROM gcr.io/distroless/base:nonroot |
| 20 | +COPY --from=builder /go/bin/preflight /bin/preflight |
| 21 | +ADD ./preflight-packages /preflight-packages |
| 22 | +# load in an example preflight.yaml |
| 23 | +ADD ./examples/pods.preflight.yaml /etc/preflight/preflight.yaml |
| 24 | +ENTRYPOINT ["preflight"] |
| 25 | +CMD ["check", "--config-file", "/etc/preflight/preflight.yaml"] |
0 commit comments