From 338d53a25e8c1b45a82385d3d2c192b061b6d95a Mon Sep 17 00:00:00 2001 From: davidko Date: Mon, 17 Jun 2024 20:34:43 +0800 Subject: [PATCH] ci: use golang bci instead of manual download Signed-off-by: davidko --- Dockerfile.dapper | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/Dockerfile.dapper b/Dockerfile.dapper index 229dc6019d..7301206bbe 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -1,30 +1,10 @@ -FROM registry.suse.com/bci/bci-base:15.6 +FROM registry.suse.com/bci/golang:1.22 ARG DAPPER_HOST_ARCH ARG http_proxy ARG https_proxy -ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} - -RUN zypper -n install gcc ca-certificates git wget curl vim less file python3-tox python3-devel iptables libdevmapper1_03 libltdl7 awk docker zip unzip && \ - rm -f /bin/sh && ln -s /bin/bash /bin/sh && \ - rm -rf /var/cache/zypp/* - -RUN if [ ${ARCH} == "s390x" ]; then \ - ln -s /usr/bin/gcc /usr/bin/s390x-linux-gnu-gcc;\ - fi - -ENV GOLANG_ARCH_amd64=amd64 GOLANG_ARCH_arm64=arm64 GOLANG_ARCH_s390x=s390x GOLANG_ARCH=GOLANG_ARCH_${ARCH} \ - GOPATH=/go PATH=/go/bin:/usr/local/go/bin:${PATH} SHELL=/bin/bash - -RUN wget -O - https://storage.googleapis.com/golang/go1.21.3.linux-${!GOLANG_ARCH}.tar.gz | tar -xzf - -C /usr/local - -RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2 - -# The docker version in dapper is too old to have buildx. Install it manually. -RUN wget https://github.com/docker/buildx/releases/download/v0.13.1/buildx-v0.13.1.linux-${ARCH} && \ - chmod +x buildx-v0.13.1.linux-${ARCH} && \ - mv buildx-v0.13.1.linux-${ARCH} /usr/local/bin/buildx +ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH} ENV DAPPER_SOURCE /go/src/github.com/longhorn/longhorn-manager ENV DAPPER_OUTPUT ./bin coverage.out ENV DAPPER_DOCKER_SOCKET true @@ -32,7 +12,19 @@ ENV DAPPER_ENV IMAGE REPO VERSION TAG TESTS DRONE_REPO DRONE_PULL_REQUEST DRONE_ ENV DAPPER_RUN_ARGS --privileged --tmpfs /go/src/github.com/longhorn/longhorn/integration/.venv:exec --tmpfs /go/src/github.com/longhorn/longhorn/integration/.tox:exec -v /dev:/host/dev ENV TRASH_CACHE ${DAPPER_SOURCE}/.trash-cache ENV HOME ${DAPPER_SOURCE} + WORKDIR ${DAPPER_SOURCE} ENTRYPOINT ["./scripts/entry"] CMD ["ci"] + +RUN zypper -n install gcc ca-certificates git wget curl vim less file python3-tox python3-devel iptables libdevmapper1_03 libltdl7 awk docker zip unzip && \ + rm -rf /var/cache/zypp/* + +# Install golangci-lint +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /go/bin v1.55.2 + +# Docker Builx: The docker version in dapper is too old to have buildx. Install it manually. +RUN curl -sSfLO https://github.com/docker/buildx/releases/download/v0.13.1/buildx-v0.13.1.linux-${ARCH} && \ + chmod +x buildx-v0.13.1.linux-${ARCH} && \ + mv buildx-v0.13.1.linux-${ARCH} /usr/local/bin/buildx \