-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (22 loc) · 1010 Bytes
/
Dockerfile
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
# multi-stage builds require: Docker v17.05+
FROM wuyumin/go:dev AS buildStage
ARG GOPROXY_VERSION=81d8283
RUN apk update && apk upgrade \
&& apk add git \
&& git clone https://github.com/goproxyio/goproxy.git goproxy \
&& cd goproxy \
&& git reset --hard ${GOPROXY_VERSION} \
&& go generate \
&& CGO_ENABLED=0 go build -ldflags="-s -w" -o goproxy \
&& upx goproxy
FROM wuyumin/go
LABEL maintainer="Yumin Wu"
COPY --from=buildStage /go/src/goproxy/goproxy /usr/bin/goproxy
RUN mkdir -p /data/pkg/mod/cache/download \
&& wget https://raw.githubusercontent.com/thisdocker/goproxy/master/default/index.html -O /data/pkg/mod/cache/download/index.html \
&& wget https://raw.githubusercontent.com/thisdocker/goproxy/master/default/favicon.ico -O /data/pkg/mod/cache/download/favicon.ico \
&& apk update && apk upgrade \
&& apk add git mercurial subversion bzr fossil \
&& rm -rf /var/cache/apk/* /tmp/*
EXPOSE 80
CMD ["/usr/bin/goproxy", "-listen=0.0.0.0:80", "-cacheDir=/data"]