-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.go10-node
56 lines (48 loc) · 1.49 KB
/
Dockerfile.go10-node
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
ARG ALPINE_IMAGE=alblockmed/alpine-node:latest
FROM $ALPINE_IMAGE
# https://hub.docker.com/_/alpine/
LABEL maintainer="matr1xc0in"
USER root
# Reference: https://github.com/docker-library/golang/blob/master/1.10/alpine3.7/Dockerfile
RUN apk add --no-cache \
bash ca-certificates \
&& [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
ENV GOLANG_VERSION 1.10.3
RUN set -eux; \
apk add --no-cache --virtual .build-deps \
bash \
gcc \
musl-dev \
openssl \
go \
; \
export \
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
GOOS="$(go env GOOS)" \
GOARCH="$(go env GOARCH)" \
GOHOSTOS="$(go env GOHOSTOS)" \
GOHOSTARCH="$(go env GOHOSTARCH)" \
; \
apkArch="$(apk --print-arch)"; \
case "$apkArch" in \
armhf) export GOARM='6' ;; \
x86) export GO386='387' ;; \
esac; \
\
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
echo '567b1cc66c9704d1c019c50bef946272e911ec6baf244310f87f4e678be155f2 *go.tgz' | sha256sum -c -; \
tar -C /usr/local -xzf go.tgz; \
rm go.tgz; \
\
cd /usr/local/go/src; \
for p in /go-alpine-patches/*.patch; do [ -f "$p" ] || continue; patch -p2 -i "$p"; done; \
./make.bash; \
rm -rf /go-alpine-patches; \
apk del .build-deps; \
export PATH="/usr/local/go/bin:$PATH"; \
go version
ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH" \
&& echo "export PATH=/usr/local/go/bin:\$GOPATH/bin:\$PATH" > /etc/profile.d/go_path.sh
WORKDIR $GOPATH