-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
48 lines (36 loc) · 1.4 KB
/
Dockerfile
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
42
43
44
45
46
47
48
# Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23-alpine as builder
WORKDIR /workspace
RUN apk update && apk add make
# Copy miscellaneous stuff.
COPY .git/ .git/
COPY hack/ hack/
COPY Makefile Makefile
COPY VERSION VERSION
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# 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
# Copy the go source.
COPY main.go main.go
COPY controllers/ controllers/
COPY pkg/ pkg/
# Build the controller.
RUN make build CGO_ENABLED=0
FROM --platform=${BUILDPLATFORM:-linux/amd64} alpine:3.21
LABEL source_repository="https://github.com/sapcc/git-cert-shim"
WORKDIR /
RUN apk update && apk upgrade --no-cache --no-progress && \
apk --update add git less openssh ca-certificates && \
rm -rf /var/lib/apt/lists/* && \
rm /var/cache/apk/* && git --version
RUN mkdir -p /root/.ssh
# Install SAP CA certificate.
RUN wget -O /usr/local/share/ca-certificates/SAP_Global_Root_CA.crt http://aia.pki.co.sap.com/aia/SAP%20Global%20Root%20CA.crt && update-ca-certificates
RUN ssh-keyscan github.wdf.sap.corp >> /root/.ssh/known_hosts
RUN echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
COPY --from=builder /workspace/bin/git-cert-shim .
RUN ["/git-cert-shim", "--version"]
ENTRYPOINT ["/git-cert-shim"]