2023-01-19 15:56:32 +00:00
|
|
|
ARG GOLANG=golang:1.19.5-alpine3.17
|
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 \
|
2022-11-28 17:27:43 +00:00
|
|
|
zlib-dev tar zip squashfs-tools npm coreutils python3 py3-pip 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 \
|
2022-04-05 20:13:48 +00:00
|
|
|
zstd pigz alpine-sdk binutils-gold btrfs-progs-dev btrfs-progs-static gawk yq \
|
2022-03-16 16:16:50 +00:00
|
|
|
&& \
|
|
|
|
if [ "$(go env GOARCH)" = "amd64" ]; then \
|
|
|
|
apk -U --no-cache add mingw-w64-gcc; \
|
|
|
|
fi
|
|
|
|
|
2022-11-28 17:27:43 +00:00
|
|
|
RUN python3 -m pip install awscli
|
|
|
|
|
2020-09-16 20:49:51 +00:00
|
|
|
RUN if [ "$(go env GOARCH)" = "arm64" ]; then \
|
2022-04-08 08:26:30 +00:00
|
|
|
wget https://github.com/aquasecurity/trivy/releases/download/v0.25.3/trivy_0.25.3_Linux-ARM64.tar.gz && \
|
|
|
|
tar -zxvf trivy_0.25.3_Linux-ARM64.tar.gz && \
|
2020-09-16 20:49:51 +00:00
|
|
|
mv trivy /usr/local/bin; \
|
|
|
|
elif [ "$(go env GOARCH)" = "arm" ]; then \
|
2022-04-08 08:26:30 +00:00
|
|
|
wget https://github.com/aquasecurity/trivy/releases/download/v0.25.3/trivy_0.25.3_Linux-ARM.tar.gz && \
|
|
|
|
tar -zxvf trivy_0.25.3_Linux-ARM.tar.gz && \
|
2020-09-16 20:49:51 +00:00
|
|
|
mv trivy /usr/local/bin; \
|
2022-04-15 16:41:40 +00:00
|
|
|
elif [ "$(go env GOARCH)" = "amd64" ]; then \
|
2022-04-08 08:26:30 +00:00
|
|
|
wget https://github.com/aquasecurity/trivy/releases/download/v0.25.3/trivy_0.25.3_Linux-64bit.tar.gz && \
|
|
|
|
tar -zxvf trivy_0.25.3_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
|
2022-04-05 20:13:48 +00:00
|
|
|
# this works for both go 1.17 and 1.18
|
|
|
|
RUN GOPROXY=direct go install golang.org/x/tools/cmd/goimports@gopls/v0.8.2
|
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 \
|
2022-04-05 20:13:48 +00:00
|
|
|
curl -sL https://raw.githubusercontent.com/golangci/golangci-lint/v1.45.2/install.sh | sh -s; \
|
2019-03-25 04:50:02 +00:00
|
|
|
fi
|
|
|
|
|
2020-02-24 20:13:59 +00:00
|
|
|
ARG SELINUX=true
|
|
|
|
ENV SELINUX $SELINUX
|
|
|
|
|
2022-03-02 23:47:27 +00:00
|
|
|
ENV DAPPER_RUN_ARGS --privileged -v k3s-cache:/go/src/github.com/k3s-io/k3s/.cache -v trivy-cache:/root/.cache/trivy
|
2022-11-28 18:16:43 +00:00
|
|
|
ENV DAPPER_ENV REPO TAG DRONE_TAG IMAGE_NAME SKIP_VALIDATE SKIP_AIRGAP AWS_SECRET_ACCESS_KEY AWS_ACCESS_KEY_ID GITHUB_TOKEN GOLANG DEBUG
|
2022-03-02 23:47:27 +00:00
|
|
|
ENV DAPPER_SOURCE /go/src/github.com/k3s-io/k3s/
|
2022-01-04 19:12:25 +00:00
|
|
|
ENV DAPPER_OUTPUT ./bin ./dist ./build/out ./build/static ./pkg/static ./pkg/deploy
|
2022-03-02 23:47:27 +00:00
|
|
|
|
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"]
|