forked from syntasso/kratix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.pipeline-adapter
41 lines (33 loc) · 1.65 KB
/
Dockerfile.pipeline-adapter
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM golang:1.22 AS builder
ARG TARGETARCH
ARG TARGETOS
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
COPY api/ api/
COPY lib/ lib/
COPY work-creator/ work-creator/
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Build work-creator binary
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GO111MODULE=on go build -a -o work-creator work-creator/pipeline/cmd/main.go
RUN mkdir work-creator-files
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/cc:nonroot
COPY --chown=nonroot:nonroot --from=busybox /usr/bin/env /usr/bin/env
COPY --chown=nonroot:nonroot --from=busybox /bin/sh /bin/sh
COPY --chown=nonroot:nonroot --from=busybox /bin/cat /bin/cat
COPY --chown=nonroot:nonroot --from=busybox /bin/date /bin/date
COPY --chown=nonroot:nonroot --from=busybox /bin/head /bin/head
COPY --chown=nonroot:nonroot --from=mikefarah/yq:4 /usr/bin/yq /bin/yq
COPY --chown=nonroot:nonroot --from=bitnami/kubectl:1.29.4 /opt/bitnami/kubectl/bin/kubectl /bin/kubectl
COPY --chown=nonroot:nonroot --from=builder /workspace/work-creator/main ./work-creator
COPY --chown=nonroot:nonroot --from=builder /workspace/work-creator/scripts/update-status /bin/update-status
COPY --chown=nonroot:nonroot --from=builder /workspace/work-creator/scripts/reader /bin/reader
COPY --chown=nonroot:nonroot --from=builder /workspace/work-creator-files /work-creator-files
USER 65532:65532
ENTRYPOINT []
CMD []