2021-12-01 21:14:59 +00:00
|
|
|
ARG GOLANG=golang:1.17.5-alpine3.15
|
2021-03-19 18:50:37 +00:00
|
|
|
FROM ${GOLANG}
|
2019-01-01 08:23:01 +00:00
|
|
|
|
2020-03-25 19:34:20 +00:00
|
|
|
ARG http_proxy=$http_proxy
|
|
|
|
ARG https_proxy=$https_proxy
|
|
|
|
ARG no_proxy=$no_proxy
|
|
|
|
ENV http_proxy=$http_proxy
|
|
|
|
ENV https_proxy=$https_proxy
|
|
|
|
ENV no_proxy=$no_proxy
|
|
|
|
|
2021-04-08 22:33:15 +00:00
|
|
|
RUN apk -U --no-cache add bash git gcc musl-dev docker vim less file curl wget ca-certificates jq linux-headers \
|
2021-09-23 20:05:11 +00:00
|
|
|
zlib-dev tar zip squashfs-tools npm coreutils python3 openssl-dev libffi-dev libseccomp libseccomp-dev \
|
2021-07-16 05:04:09 +00:00
|
|
|
libseccomp-static make libuv-static sqlite-dev sqlite-static libselinux libselinux-dev zlib-dev zlib-static \
|
2021-11-22 23:30:06 +00:00
|
|
|
zstd pigz alpine-sdk binutils-gold btrfs-progs-dev btrfs-progs-static gawk
|
2020-09-16 20:49:51 +00:00
|
|
|
RUN if [ "$(go env GOARCH)" = "arm64" ]; then \
|
2021-04-08 22:33:15 +00:00
|
|
|
wget https://github.com/aquasecurity/trivy/releases/download/v0.16.0/trivy_0.16.0_Linux-ARM64.tar.gz && \
|
|
|
|
tar -zxvf trivy_0.16.0_Linux-ARM64.tar.gz && \
|
2020-09-16 20:49:51 +00:00
|
|
|
mv trivy /usr/local/bin; \
|
|
|
|
elif [ "$(go env GOARCH)" = "arm" ]; then \
|
2021-04-08 22:33:15 +00:00
|
|
|
wget https://github.com/aquasecurity/trivy/releases/download/v0.16.0/trivy_0.16.0_Linux-ARM.tar.gz && \
|
|
|
|
tar -zxvf trivy_0.16.0_Linux-ARM.tar.gz && \
|
2020-09-16 20:49:51 +00:00
|
|
|
mv trivy /usr/local/bin; \
|
|
|
|
else \
|
2021-04-08 22:33:15 +00:00
|
|
|
wget https://github.com/aquasecurity/trivy/releases/download/v0.16.0/trivy_0.16.0_Linux-64bit.tar.gz && \
|
|
|
|
tar -zxvf trivy_0.16.0_Linux-64bit.tar.gz && \
|
2020-09-16 20:49:51 +00:00
|
|
|
mv trivy /usr/local/bin; \
|
2020-09-15 18:43:27 +00:00
|
|
|
fi
|
2021-03-19 18:50:37 +00:00
|
|
|
# this works for both go 1.15 and 1.16
|
2021-11-09 03:50:42 +00:00
|
|
|
RUN GOPROXY=direct go get golang.org/x/tools/cmd/goimports@gopls/v0.7.0
|
2019-01-22 21:14:58 +00:00
|
|
|
RUN rm -rf /go/src /go/pkg
|
2019-01-01 08:23:01 +00:00
|
|
|
|
2020-11-17 20:21:12 +00:00
|
|
|
RUN if [ "$(go env GOARCH)" = "amd64" ]; then \
|
2021-07-02 20:26:15 +00:00
|
|
|
curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.41.1; \
|
2019-03-25 04:50:02 +00:00
|
|
|
fi
|
|
|
|
|
2021-04-08 22:33:15 +00:00
|
|
|
ENV YQ_URL=https://github.com/mikefarah/yq/releases/download/v4.6.2/yq_linux
|
2020-12-23 01:28:19 +00:00
|
|
|
RUN wget -O - ${YQ_URL}_$(go env GOARCH) > /usr/bin/yq && chmod +x /usr/bin/yq
|
|
|
|
|
2020-02-24 20:13:59 +00:00
|
|
|
ARG SELINUX=true
|
|
|
|
ENV SELINUX $SELINUX
|
|
|
|
|
2020-09-18 23:13:17 +00:00
|
|
|
ENV DAPPER_RUN_ARGS --privileged -v k3s-cache:/go/src/github.com/rancher/k3s/.cache -v trivy-cache:/root/.cache/trivy
|
2021-12-08 20:36:04 +00:00
|
|
|
ENV DAPPER_ENV REPO TAG DRONE_TAG IMAGE_NAME SKIP_VALIDATE SKIP_AIRGAP GCLOUD_AUTH GITHUB_TOKEN GOLANG
|
2019-01-09 16:54:15 +00:00
|
|
|
ENV DAPPER_SOURCE /go/src/github.com/rancher/k3s/
|
2022-01-04 19:12:25 +00:00
|
|
|
ENV DAPPER_OUTPUT ./bin ./dist ./build/out ./build/static ./pkg/static ./pkg/deploy
|
2019-01-01 08:23:01 +00:00
|
|
|
ENV DAPPER_DOCKER_SOCKET true
|
|
|
|
ENV HOME ${DAPPER_SOURCE}
|
|
|
|
ENV CROSS true
|
2019-01-09 16:54:15 +00:00
|
|
|
ENV STATIC_BUILD true
|
2019-01-01 08:23:01 +00:00
|
|
|
WORKDIR ${DAPPER_SOURCE}
|
|
|
|
|
2019-01-24 17:51:14 +00:00
|
|
|
ENTRYPOINT ["./scripts/entry.sh"]
|
2019-01-01 08:23:01 +00:00
|
|
|
CMD ["ci"]
|