8000 Create Dockerfile · daniel4git/golang@5f495d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5f495d9

Browse files
authored
Create Dockerfile
create Dockerfile with images alpine/tsinghua:3.6 i made
1 parent 0852415 commit 5f495d9

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

1.8/alpine/Dockerfile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
FROM alpine/tsinghua:3.6
2+
3+
RUN apk add --no-cache ca-certificates
4+
5+
ENV GOLANG_VERSION 1.8.3
6+
7+
# https://golang.org/issue/14851 (Go 1.8 & 1.7)
8+
# https://golang.org/issue/17847 (Go 1.7)
9+
10+
COPY go1.8.3.src.tar.gz go.tgz
11+
12+
RUN set -eux; \
13+
apk add --no-cache --virtual .build-deps \
14+
bash \
15+
gcc \
16+
musl-dev \
17+
openssl \
18+
go \
19+
; \
20+
export \
21+
# set GOROOT_BOOTSTRAP such that we can actually build Go
22+
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
23+
# ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
24+
# (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
25+
GOOS="$(go env GOOS)" \
26+
GOARCH="$(go env GOARCH)" \
27+
GO386="$(go env GO386)" \
28+
GOARM="$(go env GOARM)" \
29+
GOHOSTOS="$(go env GOHOSTOS)" \
30+
GOHOSTARCH="$(go env GOHOSTARCH)" \
31+
; \
32+
\
33+
tar -C /usr/local -xzf go.tgz; \
34+
rm go.tgz; \
35+
\
36+
cd /usr/local/go/src; \
37+
./make.bash; \
38+
\
39+
rm -rf /go-alpine-patches; \
40+
apk del .build-deps; \
41+
\
42+
export PATH="/usr/local/go/bin:$PATH"; \
43+
go version
44+
45+
ENV GOPATH /go
46+
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
47+
48+
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
49+
WORKDIR $GOPATH
50+
51+
COPY go-wrapper /usr/local/bin/

0 commit comments

Comments
 (0)
0