forked from projectcalico/go-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.s390x
82 lines (61 loc) · 3.41 KB
/
Dockerfile.s390x
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
FROM alpine:3.11 as qemu
ARG QEMU_VERSION=4.2.0-6
ARG QEMU_ARCHS="s390x"
RUN apk --update add curl
# Enable non-native runs on amd64 architecture hosts
RUN for i in ${QEMU_ARCHS}; do curl -L https://github.com/multiarch/qemu-user-static/releases/download/v${QEMU_VERSION}/qemu-${i}-static.tar.gz | tar zxvf - -C /usr/bin; done
RUN chmod +x /usr/bin/qemu-*
FROM s390x/golang:1.17.5-alpine3.14
MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/community/groups/community/lozopensource)
ARG MANIFEST_TOOL_VERSION=v1.0.2
# Enable non-native builds of this image on an amd64 hosts.
# This must be the first RUN command in this file!
COPY --from=qemu /usr/bin/qemu-*-static /usr/bin/
# Install su-exec for use in the entrypoint.sh (so processes run as the right user)
# Install bash for the entry script (and because it's generally useful)
# Install curl
# Install git for fetching Go dependencies
# Install ssh for fetching Go dependencies
# Install mercurial for fetching go dependencies
# Install wget since it's useful for fetching
# Install make for building things
# Install util-linux for column command (used for output formatting).
# Install grep, sed, zip, and jq for use in some Makefiles
# Install shadow for useradd (it allows to use big UID)
RUN apk update && apk add --no-cache su-exec curl bash git openssh mercurial make wget util-linux tini file grep sed jq zip shadow libpcap-dev
RUN apk upgrade --no-cache
# Disable ssh host key checking
RUN echo 'Host *' >> /etc/ssh/ssh_config \
&& echo ' StrictHostKeyChecking no' >> /etc/ssh/ssh_config
# Disable cgo so that binaries we build will be fully static.
ENV CGO_ENABLED=0
# Recompile the standard library with cgo disabled. This prevents the standard library from being
# marked stale, causing full rebuilds every time.
RUN go install -v std
# Install ginkgo CLI tool for running tests
RUN go get github.com/onsi/ginkgo/ginkgo
# Install linting tools.
RUN wget -O - -q https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.20.0
RUN golangci-lint --version
# Install license checking tool.
RUN go get github.com/pmezard/licenses
# Install tool to merge coverage reports.
RUN go get github.com/wadey/gocovmerge
# Install CLI tool for working with yaml files
RUN GO111MODULE=on go get github.com/mikefarah/yq/v3
# Delete all the Go sources that were downloaded, we only rely on the binaries
RUN rm -rf /go/src/*
# Install generation tools.
RUN go get -u k8s.io/code-generator/cmd/openapi-gen
RUN go get -u k8s.io/code-generator/cmd/deepcopy-gen
# Install necessary Kubernetes binaries used in tests.
RUN wget https://dl.k8s.io/v1.22.2/bin/linux/s390x/kube-apiserver -O /usr/local/bin/kube-apiserver && chmod +x /usr/local/bin/kube-apiserver && \
wget https://dl.k8s.io/release/v1.22.2/bin/linux/s390x/kubectl -O /usr/local/bin/kubectl && chmod +x /usr/local/bin/kubectl && \
wget https://dl.k8s.io/v1.22.2/bin/linux/s390x/kube-controller-manager -O /usr/local/bin/kube-controller-manager && chmod +x /usr/local/bin/kube-controller-manager
# Ensure that everything under the GOPATH is writable by everyone
RUN chmod -R 777 $GOPATH
RUN curl -sSL https://github.com/estesp/manifest-tool/releases/download/${MANIFEST_TOOL_VERSION}/manifest-tool-linux-s390x > manifest-tool && \
chmod +x manifest-tool && \
mv manifest-tool /usr/bin/
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"]