From 66e31ebdbc7fb08f833cf432da918f6597bc00eb Mon Sep 17 00:00:00 2001 From: Cadey Dodrill Date: Mon, 26 Sep 2016 10:46:06 -0700 Subject: [PATCH] update dockerfiles --- base/{old-alpine => alpine}/Dockerfile | 4 +- base/{old-alpine => alpine}/README.md | 0 base/{old-alpine => alpine}/entrypoint.sh | 0 base/{old-alpine => alpine}/repositories | 0 .../runit/backplane/run | 4 +- base/{old-alpine => alpine}/runit/syslog/run | 0 lang/go/Dockerfile | 39 ++++++++ lang/go/go-wrapper | 97 +++++++++++++++++++ lang/go/no-pic.patch | 16 +++ lang/nim-devel/Dockerfile | 11 +++ 10 files changed, 168 insertions(+), 3 deletions(-) rename base/{old-alpine => alpine}/Dockerfile (88%) rename base/{old-alpine => alpine}/README.md (100%) rename base/{old-alpine => alpine}/entrypoint.sh (100%) rename base/{old-alpine => alpine}/repositories (100%) rename base/{old-alpine => alpine}/runit/backplane/run (50%) rename base/{old-alpine => alpine}/runit/syslog/run (100%) create mode 100644 lang/go/Dockerfile create mode 100644 lang/go/go-wrapper create mode 100644 lang/go/no-pic.patch create mode 100644 lang/nim-devel/Dockerfile diff --git a/base/old-alpine/Dockerfile b/base/alpine/Dockerfile similarity index 88% rename from base/old-alpine/Dockerfile rename to base/alpine/Dockerfile index 59bbd2a..3ed3dee 100644 --- a/base/old-alpine/Dockerfile +++ b/base/alpine/Dockerfile @@ -6,13 +6,13 @@ ADD ./entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"] # Add Backplane agent -ENV BACKPLANE_AGENT_VERSION 1.0.8 +ENV BACKPLANE_AGENT_VERSION 1.0.10 RUN apk add -U --no-cache wget ca-certificates \ && wget https://bin.equinox.io/c/jWahGASjoRq/backplane-stable-linux-amd64.tgz \ && tar xf backplane-stable-linux-amd64.tgz \ && mv backplane /usr/bin/backplane \ && rm backplane-stable-linux-amd64.tgz \ - && apk del wget ca-certificates + && apk del wget # update to edge ADD repositories /etc/apk/repositories diff --git a/base/old-alpine/README.md b/base/alpine/README.md similarity index 100% rename from base/old-alpine/README.md rename to base/alpine/README.md diff --git a/base/old-alpine/entrypoint.sh b/base/alpine/entrypoint.sh similarity index 100% rename from base/old-alpine/entrypoint.sh rename to base/alpine/entrypoint.sh diff --git a/base/old-alpine/repositories b/base/alpine/repositories similarity index 100% rename from base/old-alpine/repositories rename to base/alpine/repositories diff --git a/base/old-alpine/runit/backplane/run b/base/alpine/runit/backplane/run similarity index 50% rename from base/old-alpine/runit/backplane/run rename to base/alpine/runit/backplane/run index 9478b15..0394912 100755 --- a/base/old-alpine/runit/backplane/run +++ b/base/alpine/runit/backplane/run @@ -2,5 +2,7 @@ if [ -n "$BACKPLANE_TOKEN" ] then - /usr/bin/backplane connect + /usr/bin/backplane connect +else + sleep 999d fi diff --git a/base/old-alpine/runit/syslog/run b/base/alpine/runit/syslog/run similarity index 100% rename from base/old-alpine/runit/syslog/run rename to base/alpine/runit/syslog/run diff --git a/lang/go/Dockerfile b/lang/go/Dockerfile new file mode 100644 index 0000000..100f30b --- /dev/null +++ b/lang/go/Dockerfile @@ -0,0 +1,39 @@ +FROM xena/alpine + +RUN apk add --no-cache ca-certificates + +ENV GOLANG_VERSION 1.7.1 +ENV GOLANG_SRC_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz +ENV GOLANG_SRC_SHA256 2b843f133b81b7995f26d0cb64bbdbb9d0704b90c44df45f844d28881ad442d3 + +# https://golang.org/issue/14851 +COPY no-pic.patch / + +RUN set -ex \ + && apk add --no-cache --virtual .build-deps \ + bash \ + gcc \ + musl-dev \ + openssl \ + go \ + \ + && export GOROOT_BOOTSTRAP="$(go env GOROOT)" \ + \ + && wget -q "$GOLANG_SRC_URL" -O golang.tar.gz \ + && echo "$GOLANG_SRC_SHA256 golang.tar.gz" | sha256sum -c - \ + && tar -C /usr/local -xzf golang.tar.gz \ + && rm golang.tar.gz \ + && cd /usr/local/go/src \ + && patch -p2 -i /no-pic.patch \ + && ./make.bash \ + \ + && rm -rf /*.patch \ + && apk del .build-deps + +ENV GOPATH /go +ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH + +RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" +WORKDIR $GOPATH + +COPY go-wrapper /usr/local/bin/ diff --git a/lang/go/go-wrapper b/lang/go/go-wrapper new file mode 100644 index 0000000..b63e20b --- /dev/null +++ b/lang/go/go-wrapper @@ -0,0 +1,97 @@ +#!/bin/sh +set -e + +usage() { + base="$(basename "$0")" + cat <&2 + exit 1 +fi +# "shift" so that "$@" becomes the remaining arguments and can be passed along to other "go" subcommands easily +cmd="$1" +shift + +goDir="$(go list -e -f '{{.ImportComment}}' 2>/dev/null || true)" + +if [ -z "$goDir" -a -s .godir ]; then + goDir="$(cat .godir)" +fi + +dir="$(pwd -P)" +if [ "$goDir" ]; then + goPath="${GOPATH%%:*}" # this just grabs the first path listed in GOPATH, if there are multiple (which is the detection logic "go get" itself uses, too) + goDirPath="$goPath/src/$goDir" + mkdir -p "$(dirname "$goDirPath")" + if [ ! -e "$goDirPath" ]; then + ln -sfv "$dir" "$goDirPath" + elif [ ! -L "$goDirPath" ]; then + echo >&2 "error: $goDirPath already exists but is unexpectedly not a symlink!" + exit 1 + fi + goBin="$goPath/bin/$(basename "$goDir")" +else + goBin="$(basename "$dir")" # likely "app" +fi + +case "$cmd" in + download) + set -- go get -v -d "$@" + if [ "$goDir" ]; then set -- "$@" "$goDir"; fi + set -x; exec "$@" + ;; + + install) + set -- go install -v "$@" + if [ "$goDir" ]; then set -- "$@" "$goDir"; fi + set -x; exec "$@" + ;; + + run) + set -x; exec "$goBin" "$@" + ;; + + *) + echo >&2 'error: unknown command:' "$cmd" + usage >&2 + exit 1 + ;; +esac diff --git a/lang/go/no-pic.patch b/lang/go/no-pic.patch new file mode 100644 index 0000000..b10f290 --- /dev/null +++ b/lang/go/no-pic.patch @@ -0,0 +1,16 @@ +diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go +index 14f4fa9..5599307 100644 +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -1272,6 +1272,11 @@ func hostlink() { + argv = append(argv, peimporteddlls()...) + } + ++ // The Go linker does not currently support building PIE ++ // executables when using the external linker. See: ++ // https://github.com/golang/go/issues/6940 ++ argv = append(argv, "-fno-PIC") ++ + if Debug['v'] != 0 { + fmt.Fprintf(Bso, "host link:") + for _, v := range argv { diff --git a/lang/nim-devel/Dockerfile b/lang/nim-devel/Dockerfile new file mode 100644 index 0000000..07e9bbf --- /dev/null +++ b/lang/nim-devel/Dockerfile @@ -0,0 +1,11 @@ +FROM xena/alpine + +RUN apk add --no-cache g++ git +RUN git clone git://github.com/nim-lang/Nim.git nim&&\ + cd nim&& git clone --depth 1 git://github.com/nim-lang/csources&&\ + cd csources&& sh build.sh&& chmod +x ../bin/nim&&\ + cd /nim&& bin/nim c koch&& ./koch boot -d:release&&\ + ln -s `pwd`/bin/nim /bin/nim +RUN git clone https://github.com/nim-lang/nimble.git&&\ + cd nimble&& nim -d:release c -r src/nimble -y install&&\ + ln -s `pwd`/nimble /bin/nimble