forked from dell/csi-powermax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.build
78 lines (66 loc) · 2.21 KB
/
Dockerfile.build
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
ARG SOURCE_IMAGE_TAG
ARG GO_VERSION
ARG SOURCE_REPO
ARG SOURCE_IMAGE_TAG
ARG IMAGE_TYPE
FROM golang:$GO_VERSION as builder
ARG BUILD_NUMBER=0
ARG BUILD_TYPE=R
ENV BUILD_NUMBER=$BUILD_NUMBER
ENV BUILD_TYPE=$BUILD_TYPE
RUN mkdir -p /go/src
COPY csi-powermax/go.mod /go/src/csi-powermax/go.mod
COPY csi-powermax/ /go/src/csi-powermax
COPY goiscsi/ /go/src/goiscsi
COPY gofsutil/ /go/src/gofsutil
COPY gopowermax /go/src/gopowermax
COPY gobrick /go/src/gobrick
COPY gocsi /go/src/gocsi
COPY dell-csi-extensions /go/src/dell-csi-extensions
WORKDIR /go/src/csi-powermax
RUN go mod download
# Run check.sh to make sure there are no linting errors
RUN ./check.sh
RUN go generate
RUN CGO_ENABLED=0 go build
# Print the version
RUN go run core/semver/semver.go -f mk
FROM ${SOURCE_REPO}:${SOURCE_IMAGE_TAG} as driver-others
ONBUILD RUN yum install -y e2fsprogs which xfsprogs device-mapper-multipath \
&& \
yum clean all \
&& \
rm -rf /var/cache/run
FROM ${SOURCE_REPO}:${SOURCE_IMAGE_TAG} as driver-ubim
ONBUILD RUN microdnf update -y \
&& \
microdnf install -y e2fsprogs which xfsprogs device-mapper-multipath \
&& \
microdnf clean all
FROM driver-${IMAGE_TYPE} as verify
RUN which mkfs.ext4
RUN which mkfs.xfs
FROM driver-${IMAGE_TYPE} as driver
COPY --from=builder /go/src/csi-powermax/csi-powermax .
COPY "csi-powermax/csi-powermax.sh" .
ENTRYPOINT ["/csi-powermax.sh"]
# Stage to check for critical and high CVE issues via Trivy (https://github.com/aquasecurity/trivy)
# will break image build if CRITICAL issues found
# will print out all HIGH issues found
FROM driver as trivy-ubim
ONBUILD RUN microdnf install -y tar
FROM driver as trivy-others
ONBUILD RUN echo "Not a UBI minimal image"
FROM trivy-${IMAGE_TYPE} as trivy
RUN curl https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh
RUN trivy fs -s CRITICAL --ignore-unfixed --exit-code 1 / && \
trivy fs -s HIGH /
# final stage
FROM driver as final
LABEL vendor="Dell Inc." \
name="csi-powermax" \
summary="CSI Driver for Dell EMC PowerMax" \
description="CSI Driver for provisioning persistent storage from Dell EMC PowerMax" \
version="2.0.0" \
license="Apache-2.0"
COPY csi-powermax/licenses /licenses