From 945daa2ee601bf689541c7a7a3293deb73dd066c Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 31 Aug 2020 02:52:44 +0800 Subject: [PATCH] update dockerfile --- Dockerfile | 6 +++--- tun2socks.sh => entrypoint.sh | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) rename tun2socks.sh => entrypoint.sh (82%) diff --git a/Dockerfile b/Dockerfile index 4269831..f8272ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,11 +13,11 @@ RUN apk add --update --no-cache \ FROM alpine:latest -COPY ./tun2socks.sh / +COPY ./entrypoint.sh / COPY --from=builder /tun2socks-src/bin/tun2socks /tun2socks RUN apk add --update --no-cache iptables iproute2 \ - && chmod +x /tun2socks.sh + && chmod +x /entrypoint.sh ENV TUN tun0 ENV ETH eth0 @@ -34,4 +34,4 @@ ENV FAKEDNS= ENV BACKEND_DNS= ENV HOSTS= -ENTRYPOINT ["/tun2socks.sh"] +ENTRYPOINT ["/entrypoint.sh"] diff --git a/tun2socks.sh b/entrypoint.sh similarity index 82% rename from tun2socks.sh rename to entrypoint.sh index abf4d9d..728347f 100644 --- a/tun2socks.sh +++ b/entrypoint.sh @@ -2,12 +2,9 @@ TUN="${TUN:-tun0}" ETH="${ETH:-eth0}" -ETH_ADDR="${ETH_ADDR:-172.16.1.1}" TUN_ADDR="${TUN_ADDR:-198.18.0.1}" TUN_MASK="${TUN_MASK:-255.254.0.0}" -PROXY="${PROXY:-172.16.1.2:1080}" LOGLEVEL="${LOGLEVEL:-warning}" -EXCLUDED="${EXCLUDED:-172.16.1.2/32}" MONITOR="${MONITOR:-1}" MONITOR_ADDR="${MONITOR_ADDR:-0.0.0.0:80}" @@ -25,9 +22,9 @@ ip route del default > /dev/null ip route add default via "$TUN_ADDR" dev "$TUN" # add to ip route -for ip in $(echo "$EXCLUDED" | tr ',' '\n') +for addr in $(echo "$EXCLUDED" | tr ',' '\n') do - ip route add "$ip" via "$ETH_ADDR" + ip route add "$addr" via "$ETH_ADDR" done if [ -n "$EXTRACMD" ]; then