Dockerfile refresh
This commit is contained in:
82
Dockerfile
82
Dockerfile
@ -1,82 +0,0 @@
|
|||||||
FROM alpine:3.7 AS builder
|
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
|
||||||
ca-certificates
|
|
||||||
|
|
||||||
# set up nsswitch.conf for Go's "netgo" implementation
|
|
||||||
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275
|
|
||||||
# - docker run --rm debian:stretch grep '^hosts:' /etc/nsswitch.conf
|
|
||||||
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
|
|
||||||
|
|
||||||
ENV GOLANG_VERSION 1.10.3
|
|
||||||
|
|
||||||
# make-sure-R0-is-zero-before-main-on-ppc64le.patch: https://github.com/golang/go/commit/9aea0e89b6df032c29d0add8d69ba2c95f1106d9 (Go 1.9)
|
|
||||||
#COPY *.patch /go-alpine-patches/
|
|
||||||
|
|
||||||
RUN set -eux; \
|
|
||||||
apk add --no-cache --virtual .build-deps \
|
|
||||||
bash \
|
|
||||||
gcc \
|
|
||||||
musl-dev \
|
|
||||||
openssl \
|
|
||||||
go \
|
|
||||||
; \
|
|
||||||
export \
|
|
||||||
# set GOROOT_BOOTSTRAP such that we can actually build Go
|
|
||||||
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
|
|
||||||
# ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
|
|
||||||
# (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
|
|
||||||
GOOS="$(go env GOOS)" \
|
|
||||||
GOARCH="$(go env GOARCH)" \
|
|
||||||
GOHOSTOS="$(go env GOHOSTOS)" \
|
|
||||||
GOHOSTARCH="$(go env GOHOSTARCH)" \
|
|
||||||
; \
|
|
||||||
# also explicitly set GO386 and GOARM if appropriate
|
|
||||||
# https://github.com/docker-library/golang/issues/184
|
|
||||||
apkArch="$(apk --print-arch)"; \
|
|
||||||
case "$apkArch" in \
|
|
||||||
armhf) export GOARM='6' ;; \
|
|
||||||
x86) export GO386='387' ;; \
|
|
||||||
esac; \
|
|
||||||
\
|
|
||||||
wget -O go.tgz "https://dl.google.com/go/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"
|
|
||||||
WORKDIR $GOPATH
|
|
||||||
|
|
||||||
ARG GOPROXY_VERSION=master
|
|
||||||
RUN apk update; apk upgrade; \
|
|
||||||
apk add --no-cache git; \
|
|
||||||
cd /go/src/; \
|
|
||||||
mkdir github.com; \
|
|
||||||
mkdir github.com/snail007; \
|
|
||||||
cd github.com/snail007; \
|
|
||||||
git clone https://github.com/snail007/goproxy.git; \
|
|
||||||
cd goproxy; \
|
|
||||||
git checkout ${GOPROXY_VERSION}; \
|
|
||||||
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o proxy; \
|
|
||||||
chmod 0777 proxy
|
|
||||||
|
|
||||||
FROM golang:1.10.3-stretch
|
|
||||||
RUN mkdir /proxy && chmod 0777 /proxy
|
|
||||||
COPY --from=builder /go/src/github.com/snail007/goproxy/proxy /proxy/
|
|
||||||
CMD cd /proxy && /proxy ${OPTS}
|
|
||||||
31
README.md
31
README.md
@ -8,11 +8,11 @@ Proxy is a high performance HTTP, HTTPS, HTTPS, websocket, TCP, UDP, Socks5, ss
|
|||||||
|
|
||||||
**[中文手册](/README_ZH.md)**
|
**[中文手册](/README_ZH.md)**
|
||||||
|
|
||||||
**[全平台图形界面版本](/gui/README.md)**
|
**[Full-platform graphical interface version](/gui/README.md)**
|
||||||
|
|
||||||
**[全平台SDK](/sdk/README.md)**
|
**[Full platform SDK](/sdk/README.md)**
|
||||||
|
|
||||||
**[GoProxy特殊授权](/AUTHORIZATION.md)**
|
**[GoProxy special authorization](/AUTHORIZATION.md)**
|
||||||
|
|
||||||
### How to contribute to the code (Pull Request)?
|
### How to contribute to the code (Pull Request)?
|
||||||
|
|
||||||
@ -1252,12 +1252,12 @@ local execution:
|
|||||||
`proxy dns -S socks -T tcp -Z password -P 2.2.2.2:33080 -p :53`
|
`proxy dns -S socks -T tcp -Z password -P 2.2.2.2:33080 -p :53`
|
||||||
Then the local UDP port 53 provides a security and anti pollution DNS analysis.
|
Then the local UDP port 53 provides a security and anti pollution DNS analysis.
|
||||||
|
|
||||||
### TODO
|
### TODO
|
||||||
- HTTP, socks proxy which has multi parents proxy load balancing?
|
- HTTP, socks proxy which has multi parents proxy load balancing?
|
||||||
- HTTP (s) proxy support PAC?
|
- HTTP (s) proxy support PAC?
|
||||||
- Welcome joining group feedback...
|
- Welcome joining group feedback...
|
||||||
|
|
||||||
### How to use the source code?
|
### How to use the source code?
|
||||||
|
|
||||||
Recommend go1.10.1.
|
Recommend go1.10.1.
|
||||||
`go get github.com/snail007/goproxy`
|
`go get github.com/snail007/goproxy`
|
||||||
@ -1265,20 +1265,19 @@ use command cd to enter your go SRC directory
|
|||||||
then cd to enter `github.com/snail007/goproxy`.
|
then cd to enter `github.com/snail007/goproxy`.
|
||||||
Direct compilation:`go build -o proxy`
|
Direct compilation:`go build -o proxy`
|
||||||
execution: `go run *.go`
|
execution: `go run *.go`
|
||||||
`utils` is a toolkit, and `service` is a specific service class.
|
`utils` is a toolkit, and `service` is a specific service class.
|
||||||
|
|
||||||
### License
|
### License
|
||||||
Proxy is licensed under GPLv3 license.
|
Proxy is licensed under GPLv3 license.
|
||||||
|
|
||||||
### Contact
|
### Contact
|
||||||
proxy QQ group:189618940
|
proxy QQ group:189618940
|
||||||
|
|
||||||
### Donation
|
### Donation
|
||||||
if proxy help you a lot,you can support us by:
|
if proxy help you a lot,you can support us by:
|
||||||
### AliPay
|
|
||||||
<img src="https://github.com/snail007/goproxy/blob/master/docs/images/alipay.jpg?raw=true" width="200"/>
|
|
||||||
|
|
||||||
### Wechat Pay
|
|
||||||
<img src="https://github.com/snail007/goproxy/blob/master/docs/images/wxpay.jpg?raw=true" width="200"/>
|
|
||||||
|
|
||||||
|
### AliPay
|
||||||
|
<img src="https://github.com/snail007/goproxy/blob/master/docs/images/alipay.jpg?raw=true" width="200"/>
|
||||||
|
|
||||||
|
### Wechat Pay
|
||||||
|
<img src="https://github.com/snail007/goproxy/blob/master/docs/images/wxpay.jpg?raw=true" width="200"/>
|
||||||
|
|||||||
19
docker/Dockerfile
Normal file
19
docker/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
FROM golang:alpine AS builder
|
||||||
|
WORKDIR $GOPATH
|
||||||
|
ARG GOPROXY_VERSION=master
|
||||||
|
RUN apk update; apk upgrade; \
|
||||||
|
apk add --no-cache ca-certificates git; \
|
||||||
|
cd /go/src/; \
|
||||||
|
mkdir -p github.com/snail007; \
|
||||||
|
cd github.com/snail007; \
|
||||||
|
git clone --depth=1 https://github.com/snail007/goproxy.git; \
|
||||||
|
cd goproxy; \
|
||||||
|
git checkout ${GOPROXY_VERSION}; \
|
||||||
|
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -a -installsuffix cgo -o proxy; \
|
||||||
|
chmod 0777 proxy
|
||||||
|
|
||||||
|
FROM debian:stable-slim
|
||||||
|
COPY --from=builder /go/src/github.com/snail007/goproxy/proxy /usr/local/bin/
|
||||||
|
# RUN chmod 0777 /usr/local/bin/proxy
|
||||||
|
EXPOSE 80 443
|
||||||
|
CMD /usr/local/bin/proxy http -t tcp -p :80,:443
|
||||||
Reference in New Issue
Block a user