-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 1.08 KB
/
Dockerfile
File metadata and controls
41 lines (30 loc) · 1.08 KB
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 --platform=$BUILDPLATFORM golang:1.26 AS builder
ARG TARGETARCH
ARG TARGETOS
WORKDIR /workspace
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOOS=${TARGETOS}
ENV GOARCH=${TARGETARCH}
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go build -o /out/manager cmd/main.go
RUN --mount=target=. \
--mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go build -o /out/pipeline-adapter work-creator/*.go
# Using alpine/git image as base, as it contains the /usr/bin/git binary needed
# by the Kratix Git Writer. It also contains the /usr/bin/env and /bin/sh
# binaries needed to use the image as the pipeline-adapter image.
FROM alpine/git
WORKDIR /
COPY --from=builder /out/manager /manager
COPY --from=builder /out/pipeline-adapter /bin/pipeline-adapter
RUN addgroup -g 65532 app && \
adduser -D -H -u 65532 -G app appuser && \
mkdir -p /home/appuser/.ssh && \
chown -R 65532:65532 /home/appuser
ENV HOME=/home/appuser
USER 65532:65532
ENTRYPOINT ["/manager"]