diff --git a/install/docker/Dockerfile.Action b/install/docker/Dockerfile.Action index ecc526e656..9c45bfa00d 100644 --- a/install/docker/Dockerfile.Action +++ b/install/docker/Dockerfile.Action @@ -1,8 +1,9 @@ FROM alpine:latest AS builder -WORKDIR /build +WORKDIR / COPY ./install/docker/docker_helper.sh ./docker_helper.sh +COPY ./install/docker/iptables.sh ./iptables.sh +COPY ./install/docker/ip6tables.sh ./ip6tables.sh RUN sh -c "$(cat ./docker_helper.sh)" -RUN apk add --no-cache iptables ip6tables nftables tzdata RUN rm ./docker_helper.sh EXPOSE 2017 VOLUME /etc/v2raya diff --git a/install/docker/docker_helper.sh b/install/docker/docker_helper.sh index 5047c3c337..b7f11cda20 100644 --- a/install/docker/docker_helper.sh +++ b/install/docker/docker_helper.sh @@ -18,6 +18,7 @@ case "$(arch)" in *) ;; esac +mkdir -p build && cd build || exit wget https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-linux-$v2ray_arch.zip wget https://github.com/XTLS/Xray-core/releases/latest/download/Xray-linux-$v2ray_arch.zip wget https://github.com/v2rayA/v2rayA/releases/download/vRealv2rayAVersion/v2raya_linux_"$v2raya_arch"_Realv2rayAVersion @@ -33,3 +34,13 @@ wget -O /usr/local/share/v2raya/LoyalsoldierSite.dat https://raw.githubuserconte wget -O /usr/local/share/v2raya/geosite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat wget -O /usr/local/share/v2raya/geoip.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geoip.dat cd "$current_dir" && rm -rf "$current_dir"/cache +apk add --no-cache tzdata iptables-legacy nftables +cd .. +rm -rf build +[ -d /usr/local/sbin ] || mkdir -p /usr/local/sbin +install ./iptables.sh /usr/local/sbin/iptables +install ./ip6tables.sh /usr/local/sbin/ip6tables +install ./iptables.sh /usr/local/sbin/iptables-nft +install ./ip6tables.sh /usr/local/sbin/ip6tables-nft +install ./iptables.sh /usr/local/sbin/iptables-legacy +install ./ip6tables.sh /usr/local/sbin/ip6tables-legacy \ No newline at end of file diff --git a/install/docker/ip6tables.sh b/install/docker/ip6tables.sh new file mode 100644 index 0000000000..0ba2c8965a --- /dev/null +++ b/install/docker/ip6tables.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ "$V2RAYA_NFTABLES_SUPPORT" != on ]; then + if [ "$IPTABLES_MODE" = "nftables" ]; then + /sbin/ip6tables-nft "$@" + elif [ "$IPTABLES_MODE" = "legacy" ]; then + /sbin/ip6tables-legacy "$@" + else + /sbin/ip6tables "$@" + fi +fi \ No newline at end of file diff --git a/install/docker/iptables.sh b/install/docker/iptables.sh new file mode 100644 index 0000000000..757ab5e843 --- /dev/null +++ b/install/docker/iptables.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ "$V2RAYA_NFTABLES_SUPPORT" != on ]; then + if [ "$IPTABLES_MODE" = "nftables" ]; then + /sbin/iptables-nft "$@" + elif [ "$IPTABLES_MODE" = "legacy" ]; then + /sbin/iptables-legacy "$@" + else + /sbin/iptables "$@" + fi +fi \ No newline at end of file