forked from openclarity/openclarity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.runtime_k8s_scanner
46 lines (34 loc) · 1.18 KB
/
Dockerfile.runtime_k8s_scanner
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
FROM golang:1.17.9-alpine AS builder
ARG VERSION
ARG BUILD_TIMESTAMP
ARG COMMIT_HASH
RUN apk add --update --no-cache gcc g++ git
# Copy runtime scan api code
WORKDIR /build/runtime_scan
COPY runtime_scan/api ./api
# Copy sbom db api code
WORKDIR /build/sbom_db
COPY sbom_db/api ./api
# Copy shared go.mod & go.sum
WORKDIR /build/shared
COPY shared/go.* ./
RUN go mod download
# Copy scanner go.mod & go.sum
WORKDIR /build/runtime_k8s_scanner
COPY runtime_k8s_scanner/go.* ./
RUN go mod download
# Copy shared code
WORKDIR /build/shared
COPY shared .
# Copy and build scanner code
WORKDIR /build/runtime_k8s_scanner
COPY runtime_k8s_scanner .
RUN go build -ldflags="-s -w \
-X 'github.com/openclarity/kubeclarity/runtime_k8s_scanner/pkg/version.Version=${VERSION}' \
-X 'github.com/openclarity/kubeclarity/runtime_k8s_scanner/pkg/version.CommitHash=${COMMIT_HASH}' \
-X 'github.com/openclarity/kubeclarity/runtime_k8s_scanner/pkg/version.BuildTimestamp=${BUILD_TIMESTAMP}'" \
-o runtime_k8s_scanner ./cmd/main.go
FROM alpine:3.15.4
WORKDIR /app
COPY --from=builder ["/build/runtime_k8s_scanner/runtime_k8s_scanner", "./runtime_k8s_scanner"]
ENTRYPOINT ["/app/runtime_k8s_scanner"]