dockerfiles/lang/go/Dockerfile

40 lines
948 B
Docker
Raw Normal View History

2016-09-26 17:46:06 +00:00
FROM xena/alpine
RUN apk add --no-cache ca-certificates
2017-01-09 23:28:20 +00:00
ENV GOLANG_VERSION 1.7.4
2016-09-26 17:46:06 +00:00
ENV GOLANG_SRC_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz
2017-01-09 23:28:20 +00:00
ENV GOLANG_SRC_SHA256 4c189111e9ba651a2bb3ee868aa881fab36b2f2da3409e80885ca758a6b614cc
2016-09-26 17:46:06 +00:00
# https://golang.org/issue/14851
COPY no-pic.patch /
RUN set -ex \
2017-01-09 23:28:20 +00:00
&& apk add --no-cache --virtual go-build-deps \
2016-09-26 17:46:06 +00:00
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 \
2017-01-09 23:28:20 +00:00
&& apk del go-build-deps
2016-09-26 17:46:06 +00:00
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/