diff options
author | song.zhu <song.zhu@linaro.org> | 2017-08-10 11:24:22 +0800 |
---|---|---|
committer | Fathi Boudra <fathi.boudra@linaro.org> | 2017-08-13 16:39:26 +0300 |
commit | 6baded7dabe75c8003f72e4de1abf7cda261b3bd (patch) | |
tree | 4c3a63b3ae5fb13a330f2ac810e888a3f032b827 /alpine-aarch64-leg-go-build | |
parent | 32af3ecd6a4953e281a3470dad9bd296e1db0add (diff) |
alpine-aarch64-leg-go-build: new docker image
Based on Calico project go-build for arm64:
https://github.com/projectcalico/go-build.git
Change-Id: I20ef5ac3829e5d3576b7a848b55bc2cd703b1855
Signed-off-by: song.zhu <song.zhu@linaro.org>
Diffstat (limited to 'alpine-aarch64-leg-go-build')
-rw-r--r-- | alpine-aarch64-leg-go-build/Dockerfile | 74 | ||||
-rwxr-xr-x | alpine-aarch64-leg-go-build/build.sh | 9 | ||||
-rwxr-xr-x | alpine-aarch64-leg-go-build/entrypoint.sh | 24 |
3 files changed, 107 insertions, 0 deletions
diff --git a/alpine-aarch64-leg-go-build/Dockerfile b/alpine-aarch64-leg-go-build/Dockerfile new file mode 100644 index 00000000..c7755765 --- /dev/null +++ b/alpine-aarch64-leg-go-build/Dockerfile @@ -0,0 +1,74 @@ +FROM arm64v8/golang:1.8.1-alpine + +# Based on Tom Denham <tom@projectcalico.org> work +# https://github.com/projectcalico/go-build +MAINTAINER Song Zhu <song.zhu@linaro.org> + +# 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 to download glide +# Install git for fetching Go dependencies +# Install ssh for fetching Go dependencies +# Install mercurial for fetching go dependencies +# Install wget for fetching glibc +# Install make for building things +# Install util-linux for column command (used for output formatting). +RUN apk add --no-cache su-exec \ + bash \ + curl \ + git \ + make \ + mercurial \ + openssh \ + util-linux \ + wget + +# Disable ssh host key checking +RUN echo 'Host *' >> /etc/ssh/ssh_config \ + && echo ' StrictHostKeyChecking no' >> /etc/ssh/ssh_config + +# Install glibc +RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub \ + && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk \ + && apk add glibc-2.23-r3.apk + +# Disable cgo so that binaries we build will be fully static +ENV CGO_ENABLED=0 + +# Apply patches to Go runtime and recompile +# See https://github.com/golang/go/issues/5838 for defails of vfork patch + +# 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 glide +RUN go get github.com/Masterminds/glide +ENV GLIDE_HOME /home/user/.glide + +# Install ginkgo CLI tool for running tests +RUN go get github.com/onsi/ginkgo/ginkgo + +# Install linting tools +RUN go get -u gopkg.in/alecthomas/gometalinter.v1 \ + && ln -s $(which gometalinter.v1) /usr/local/bin/gometalinter \ + && gometalinter --install + +# 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 patched version of goveralls (upstream is bugged if not used from Travis) +RUN wget https://github.com/fasaxc/goveralls/releases/download/v0.0.1-smc/goveralls \ + && chmod +x goveralls \ + && mv goveralls /usr/bin/ + +# Ensure that everything under the GOPATH is writable by everyone +RUN chmod -R 777 $GOPATH + +COPY entrypoint.sh /usr/local/bin/entrypoint.sh + +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/alpine-aarch64-leg-go-build/build.sh b/alpine-aarch64-leg-go-build/build.sh new file mode 100755 index 00000000..02fc7bff --- /dev/null +++ b/alpine-aarch64-leg-go-build/build.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +export LANG=C + +image=linaro/ci-aarch64-leg-go-build-alpine +docker build --pull --tag=$image . +echo $image > .docker-tag diff --git a/alpine-aarch64-leg-go-build/entrypoint.sh b/alpine-aarch64-leg-go-build/entrypoint.sh new file mode 100755 index 00000000..5627c23e --- /dev/null +++ b/alpine-aarch64-leg-go-build/entrypoint.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Add local user +# Either use the LOCAL_USER_ID if passed in at runtime or +# fallback + +USER_ID=${LOCAL_USER_ID:-9001} + +echo "Starting with UID : $USER_ID" 1>&2 +adduser -D -s /bin/bash -u $USER_ID -g "" user +export HOME=/home/user + +if [ -n "$EXTRA_GROUP_ID" ]; then + echo "Adding user to additional GID : $EXTRA_GROUP_ID" 1>&2 + # Adding the group can fail if it already exists. + if addgroup -g $EXTRA_GROUP_ID group; then + addgroup user group + else + echo "Adding user to existing group instead" 1>&2 + addgroup user $(getent group $EXTRA_GROUP_ID | cut -d: -f1) + fi +fi + +exec /sbin/su-exec user "$@" |