-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.cn
51 lines (44 loc) · 1.55 KB
/
Dockerfile.cn
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM golang:1.21-alpine AS builder
WORKDIR /app
# ========= CONFIG =========
# download links
ENV MODIFIED_DERPER_GIT=https://ghproxy.com/github.com/zhj9709/tailscale.git
# ==========================
# install necessary packages && compile derper
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
&& apk update && apk add --no-cache git \
&& go env -w GO111MODULE=on \
&& go env -w GOPROXY=https://goproxy.cn,direct \
&& git clone $MODIFIED_DERPER_GIT tailscale --depth 1 \
&& cd /app/tailscale/cmd/derper \
&& go build -ldflags "-s -w" -o /app/derper \
&& rm -rf /app/tailscale
# ========= derper image =========
FROM alpine:latest
WORKDIR /app
# derper args
ENV DERP_HOST=127.0.0.1 \
DERP_CERT_DIR=/app/certs \
DERP_ADDR=:443 \
DERP_STUN=true \
DERP_STUN_PORT=3478 \
DERP_HTTP_PORT=-1 \
DERP_VERIFY_CLIENTS=false
COPY build_cert.sh /app
COPY --from=builder /app/derper /app/derper
# install necessary packages && build self-signed certs
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories \
&& apk update \
&& apk add --no-cache openssl \
&& chmod +x /app/derper \
&& chmod +x /app/build_cert.sh \
&& /app/build_cert.sh $DERP_HOST $DERP_CERT_DIR /app/san.conf
# start derper
CMD /app/derper --hostname=$DERP_HOST \
--certdir=$DERP_CERT_DIR \
--certmode=manual \
--a=$DERP_ADDR \
--stun=$DERP_STUN \
--stun-port=$DERP_STUN_PORT \
--http-port=$DERP_HTTP_PORT \
--verify-clients=$DERP_VERIFY_CLIENTS