Skip to content

Commit e25c671

Browse files
author
wei xiao
committed
Remove no-pic patch
For two reasons: 1) Alpine has fixed the issue (http://git.alpinelinux.org/cgit/aports/tree/community/go/default-buildmode-pie.patch) 2) The patch doesn't work for some platforms where Golang adopts external linker (golang/go#17847). Although Golang developers has fixed the issue with disabling PIE, above Alpine solution is more secure So, Alpine Go (installed by apk) is better choice.
1 parent 7319ccc commit e25c671

File tree

2 files changed

+2
-43
lines changed

2 files changed

+2
-43
lines changed

1.7/alpine/Dockerfile

+2-27
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,11 @@ FROM alpine:3.4
22

33
RUN apk add --no-cache ca-certificates
44

5-
ENV GOLANG_VERSION 1.7.3
6-
ENV GOLANG_SRC_URL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz
7-
ENV GOLANG_SRC_SHA256 79430a0027a09b0b3ad57e214c4c1acfdd7af290961dd08d322818895af1ef44
8-
9-
# https://golang.org/issue/14851
10-
COPY no-pic.patch /
11-
125
RUN set -ex \
13-
&& apk add --no-cache --virtual .build-deps \
14-
bash \
15-
gcc \
16-
musl-dev \
17-
openssl \
18-
go \
19-
\
20-
&& export GOROOT_BOOTSTRAP="$(go env GOROOT)" \
21-
\
22-
&& wget -q "$GOLANG_SRC_URL" -O golang.tar.gz \
23-
&& echo "$GOLANG_SRC_SHA256 golang.tar.gz" | sha256sum -c - \
24-
&& tar -C /usr/local -xzf golang.tar.gz \
25-
&& rm golang.tar.gz \
26-
&& cd /usr/local/go/src \
27-
&& patch -p2 -i /no-pic.patch \
28-
&& ./make.bash \
29-
\
30-
&& rm -rf /*.patch \
31-
&& apk del .build-deps
6+
&& apk add --no-cache go
327

338
ENV GOPATH /go
34-
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
9+
ENV PATH $GOPATH/bin:$PATH
3510

3611
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
3712
WORKDIR $GOPATH

1.7/alpine/no-pic.patch

-16
This file was deleted.

0 commit comments

Comments
 (0)