forked from rancher/image-build-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.amd64
48 lines (46 loc) · 1.62 KB
/
Dockerfile.amd64
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
ARG GOLANG_VERSION=1.17.5
FROM library/golang:${GOLANG_VERSION}-alpine3.15 AS goboring
ARG GOBORING_BUILD=7
RUN apk --no-cache add \
bash \
g++
ADD https://go-boringcrypto.storage.googleapis.com/go${GOLANG_VERSION}b${GOBORING_BUILD}.src.tar.gz /usr/local/boring.tgz
WORKDIR /usr/local/boring
RUN tar xzf ../boring.tgz
WORKDIR /usr/local/boring/go/src
RUN ./make.bash
COPY scripts/ /usr/local/boring/go/bin/
FROM library/golang:${GOLANG_VERSION}-alpine3.15 AS trivy
ARG TRIVY_VERSION=0.18.3
RUN set -ex; \
if [ "$(go env GOARCH)" = "arm64" ]; then \
wget -q "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-ARM64.tar.gz"; \
tar -xzf trivy_${TRIVY_VERSION}_Linux-ARM64.tar.gz --include trivy -C /usr/local/bin; \
mv trivy /usr/local/bin; \
else \
wget -q "https://github.com/aquasecurity/trivy/releases/download/v${TRIVY_VERSION}/trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz"; \
tar -xzf trivy_${TRIVY_VERSION}_Linux-64bit.tar.gz; \
mv trivy /usr/local/bin; \
fi
FROM library/golang:${GOLANG_VERSION}-alpine3.15
RUN apk --no-cache add \
bash \
coreutils \
curl \
docker \
file \
g++ \
gcc \
git \
make \
mercurial \
rsync \
subversion \
wget
RUN rm -fr /usr/local/go/*
COPY --from=goboring /usr/local/boring/go/ /usr/local/go/
COPY --from=trivy /usr/local/bin/ /usr/bin/
RUN set -x \
&& chmod -v +x /usr/local/go/bin/go-*.sh \
&& go version \
&& trivy --download-db-only --quiet