forked from rancher/backup-restore-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.dapper
55 lines (44 loc) · 1.96 KB
/
Dockerfile.dapper
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
FROM registry.suse.com/bci/golang:1.19
# Add buildx plugin
COPY --from=docker.io/docker/buildx-bin:0.8.2 /buildx /usr/libexec/docker/cli-plugins/docker-buildx
ARG DAPPER_HOST_ARCH
ENV ARCH $DAPPER_HOST_ARCH
RUN zypper -n in git-core curl tar gzip docker wget awk hostname && \
zypper -n clean -a && \
rm -rf /tmp/* /var/tmp/* /usr/share/doc/packages/*
RUN if [ "${ARCH}" == "amd64" ]; then \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.50.1; \
fi
RUN curl -sL https://get.helm.sh/helm-v3.9.0-linux-${ARCH}.tar.gz | tar xvzf - -C /usr/local/bin --strip-components=1
RUN if [ "${ARCH}" != "s390x" ]; then \
helm plugin install https://github.com/quintush/helm-unittest; \
fi
ENV K3S_BINARY_amd64=k3s \
K3S_BINARY_arm64=k3s-arm64 \
K3S_BINARY_s390x=k3s-s390x \
K3S_BINARY=K3S_BINARY_${ARCH}
ARG K8S_VERSION_FROM_DRONE
ENV K8S_VERSION $K8S_VERSION_FROM_DRONE
RUN if [ -z "${K8S_VERSION}" ]; then export K8S_VERSION="v1.24" && echo $(date +%s%N); fi
# ENV K8S_VERSION="${K8S_VERSION_FROM_DRONE:-'v1.24'}"
RUN echo "${K8S_VERSION}"
RUN curl -sL https://github.com/rancher/k3s/releases/download/$(curl -Ls -o /dev/null -w %{url_effective} https://update.k3s.io/v1-release/channels/${K8S_VERSION} | awk -F/ '{ print $NF }')/${!K3S_BINARY} > /usr/local/bin/k3s && \
chmod +x /usr/local/bin/k3s
RUN if [ "${ARCH}" != "s390x" ]; then \
curl -sL https://dl.min.io/client/mc/release/linux-${ARCH}/mc > /usr/local/bin/mc && \
chmod +x /usr/local/bin/mc; \
fi
ENV DAPPER_ENV REPO TAG DRONE_TAG CROSS USE_DOCKER_BUILDX
ENV DAPPER_SOURCE /go/src/github.com/rancher/backup-restore-operator/
ENV DAPPER_OUTPUT ./bin ./dist
ENV GOCACHE /root/.cache/go-build
ENV GOPATH /go
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_RUN_ARGS --privileged
VOLUME /var/lib/rancher/k3s
VOLUME /var/lib/cni
VOLUME /var/log
ENV HOME ${DAPPER_SOURCE}
WORKDIR ${DAPPER_SOURCE}
ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]