Browse Source

build: add isc dhcp service

v1.x.x
dnomd343 2 years ago
parent
commit
7490c72561
  1. 32
      Dockerfile

32
Dockerfile

@ -8,24 +8,32 @@ WORKDIR ./upx-${UPX_VERSION}-src/
RUN make -C ./src/ && mkdir -p /upx/bin/ && mv ./src/upx.out /upx/bin/upx && \
mkdir -p /upx/lib/ && cd /usr/lib/ && cp -d ./libgcc_s.so* ./libstdc++.so* ./libucl.so* /upx/lib/
FROM golang:1.18-alpine3.16 AS proxy
FROM golang:1.18-alpine3.16 AS xray
ENV XRAY_VERSION="1.5.9"
ENV V2FLY_VERSION="4.45.2"
ENV SAGER_VERSION="5.0.16"
RUN wget https://github.com/XTLS/Xray-core/archive/refs/tags/v${XRAY_VERSION}.tar.gz && tar xf v${XRAY_VERSION}.tar.gz
RUN wget https://github.com/v2fly/v2ray-core/archive/refs/tags/v${V2FLY_VERSION}.tar.gz && tar xf v${V2FLY_VERSION}.tar.gz
RUN wget https://github.com/SagerNet/v2ray-core/archive/refs/tags/v${SAGER_VERSION}.tar.gz && tar xf v${SAGER_VERSION}.tar.gz
WORKDIR ./Xray-core-${XRAY_VERSION}/
RUN go mod download -x
RUN env CGO_ENABLED=0 go build -v -o xray -trimpath -ldflags "-s -w" ./main/ && mv ./xray /tmp/
WORKDIR ../v2ray-core-${V2FLY_VERSION}/
COPY --from=upx /upx/ /usr/
RUN upx -9 /tmp/xray
FROM golang:1.18-alpine3.16 AS v2ray
ENV V2FLY_VERSION="4.45.2"
RUN wget https://github.com/v2fly/v2ray-core/archive/refs/tags/v${V2FLY_VERSION}.tar.gz && tar xf v${V2FLY_VERSION}.tar.gz
WORKDIR ./v2ray-core-${V2FLY_VERSION}/
RUN go mod download -x
RUN env CGO_ENABLED=0 go build -v -o v2ray -trimpath -ldflags "-s -w" ./main/ && mv ./v2ray /tmp/
WORKDIR ../v2ray-core-${SAGER_VERSION}/
COPY --from=upx /upx/ /usr/
RUN upx -9 /tmp/v2ray
FROM golang:1.18-alpine3.16 AS sagray
ENV SAGER_VERSION="5.0.16"
RUN wget https://github.com/SagerNet/v2ray-core/archive/refs/tags/v${SAGER_VERSION}.tar.gz && tar xf v${SAGER_VERSION}.tar.gz
WORKDIR ./v2ray-core-${SAGER_VERSION}/
RUN go mod download -x
RUN env CGO_ENABLED=0 go build -v -o sagray -trimpath -ldflags "-s -w" ./main/ && mv ./sagray /tmp/
COPY --from=upx /upx/ /usr/
RUN ls /tmp/*ray | xargs -P0 -n1 upx -9
RUN upx -9 /tmp/sagray
FROM golang:1.18-alpine3.16 AS xproxy
COPY . /XProxy
@ -42,10 +50,14 @@ RUN wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/downlo
RUN wget "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"
RUN mkdir -p /asset/ && tar cJf /asset/assets.tar.xz ./*.dat
COPY --from=xproxy /tmp/xproxy /asset/usr/bin/
COPY --from=proxy /tmp/*ray /asset/usr/bin/
COPY --from=sagray /tmp/sagray /asset/usr/bin/
COPY --from=v2ray /tmp/v2ray /asset/usr/bin/
COPY --from=xray /tmp/xray /asset/usr/bin/
FROM alpine:3.16
RUN apk add --no-cache iptables ip6tables radvd && mkdir -p /run/radvd/
RUN apk add --no-cache dhcp iptables ip6tables radvd && \
mkdir -p /run/radvd/ && rm -f /etc/dhcp/dhcpd.conf.example && \
touch /var/lib/dhcp/dhcpd.leases && touch /var/lib/dhcp/dhcpd6.leases
COPY --from=asset /asset/ /
WORKDIR /xproxy
ENTRYPOINT ["xproxy"]

Loading…
Cancel
Save