forked from serjs/socks5-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
27 lines (21 loc) · 907 Bytes
/
Dockerfile
File metadata and controls
27 lines (21 loc) · 907 Bytes
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
FROM golang:1.26-alpine AS builder
RUN apk --no-cache add tzdata
WORKDIR /go/src/github.com/serjs/socks5
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-s' -o ./socks5
FROM gcr.io/distroless/static:nonroot AS distroless
COPY --from=builder /go/src/github.com/serjs/socks5/socks5 /
ENTRYPOINT ["/socks5"]
# https://hub.docker.com/r/alpine/curl/tags
FROM alpine/curl:8.17.0 AS curl
COPY --from=distroless /socks5 /bin
ENV PROXY_PORT=1080
# Expressions don't expand in single quotes, use double quotes for that.
# hadolint ignore=SC2016
RUN echo 'curl -ipv4 --proxy socks5://${PROXY_USER}:${PROXY_PASSWORD}@0.0.0.0:${PROXY_PORT} -vI -H "user-agent: socks5/healthcheck" http://example.com/' > /healthcheck.sh \
&& chown nobody /healthcheck.sh \
&& chmod 744 /healthcheck.sh
HEALTHCHECK CMD /healthcheck.sh
USER nobody
EXPOSE 1080
ENTRYPOINT ["/bin/socks5"]