dockerfiles/lang/go/Dockerfile

38 lines
797 B
Docker

FROM xena/alpine
RUN apk add --no-cache ca-certificates
ENV GOLANG_VERSION 1.7.5
ENV GOLANG_SRC_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz
# https://golang.org/issue/14851
COPY no-pic.patch /
RUN set -ex \
&& apk add --no-cache --virtual go-build-deps \
bash \
gcc \
musl-dev \
openssl \
go \
\
&& export GOROOT_BOOTSTRAP="$(go env GOROOT)" \
\
&& wget -q "$GOLANG_SRC_URL" -O golang.tar.gz \
&& 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 go-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/