-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathDockerfile
41 lines (36 loc) · 1.17 KB
/
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
36
37
38
39
40
41
ARG ALPINE="alpine:3.20"
ARG GOLANG="golang:1.23-alpine3.20"
FROM ${GOLANG} AS xray
ENV XRAY="1.8.24"
RUN wget https://github.com/XTLS/Xray-core/archive/v${XRAY}.tar.gz -O- | tar xz
WORKDIR ./Xray-core-${XRAY}/main/
RUN go get
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-s -w"
RUN mv main /xray
FROM ${GOLANG} AS xproxy
RUN apk add git
COPY ./ /XProxy/
WORKDIR /XProxy/cmd/
RUN go get
RUN env CGO_ENABLED=0 go build -v -trimpath -ldflags "-X main.version=$(git describe --tag) -s -w"
RUN mv cmd /xproxy
FROM ${ALPINE} AS assets
RUN apk add xz
RUN wget "https://cdn.dnomd343.top/v2ray-rules-dat/geoip.dat"
RUN wget "https://cdn.dnomd343.top/v2ray-rules-dat/geosite.dat"
RUN tar cJf /assets.tar.xz geoip.dat geosite.dat
FROM ${ALPINE} AS release
RUN apk add upx
WORKDIR /release/run/radvd/
WORKDIR /release/var/lib/dhcp/
RUN touch dhcpd.leases dhcpd6.leases
COPY --from=xproxy /xproxy /release/usr/bin/
COPY --from=assets /assets.tar.xz /release/
COPY --from=xray /xray /release/usr/bin/
WORKDIR /release/usr/bin/
RUN ls | xargs -n1 -P0 upx -9
FROM ${ALPINE}
RUN apk add --no-cache dhcp radvd iptables ip6tables
COPY --from=release /release/ /
WORKDIR /xproxy/
ENTRYPOINT ["xproxy"]