dockerfiles/lang/go/Dockerfile

40 lines
944 B
Docker
Raw Normal View History

2016-09-26 17:46:06 +00:00
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/