refactor docker

This commit is contained in:
Hiddify
2024-03-15 09:33:57 +01:00
parent 6303adc810
commit 7e21b935f8
3 changed files with 47 additions and 11 deletions

View File

@@ -1,18 +1,18 @@
FROM alpine:latest
ENV CONFIG='https://raw.githubusercontent.com/ircfspace/warpsub/main/export/warp#WARP%20(IRCF)'
ENV VERSION=0.17.8
ENV VERSION=v0.17.8
WORKDIR /hiddify
RUN apk add wget tar gzip libc6-compat
RUN apk add curl tar gzip libc6-compat # iptables ip6tables
RUN case "$(apk --print-arch)" in \
x86_64) ARCH=amd64 ;; \
i386) ARCH=386 ;; \
armv7l) ARCH=arm ;; \
aarch64) ARCH=arm64 ;; \
*) echo "Unsupported architecture: $(apk --print-arch) $(uname -m)" && exit 1 ;; \
esac && \
curl -l -o hiddify-cli.tar.gz https://github.com/hiddify/hiddify-next-core/releases/download/${VERSION}/hiddify-cli-linux-$ARCH.tar.gz && \
tar -xzf hiddify-cli.tar.gz && rm hiddify-cli.tar.gz
RUN case "$(apk --print-arch)" in \
x86_64) ARCH=amd64 ;; \
i386) ARCH=386 ;; \
armv7l) ARCH=arm ;; \
aarch64) ARCH=arm64 ;; \
*) echo "Unsupported architecture: $(apk --print-arch) $(uname -m)" && exit 1 ;; \
esac && \
curl -L -o hiddify-cli.tar.gz https://github.com/hiddify/hiddify-next-core/releases/download/${VERSION}/hiddify-cli-linux-$ARCH.tar.gz && \
tar -xzf hiddify-cli.tar.gz && rm hiddify-cli.tar.gz
COPY hiddify.sh .
RUN chmod +x hiddify.sh
COPY hiddify.json ./data/

View File

@@ -1,6 +1,40 @@
#!/bin/sh
# sysctl -w net.ipv4.ip_forward=1
# sysctl -w net.ipv6.ip_forward=1
# ip rule add fwmark 1 table 100 ;
# ip route add local 0.0.0.0/0 dev lo table 100
# # CREATE TABLE
# iptables -t mangle -N hiddify
# # RETURN LOCAL AND LANS
# iptables -t mangle -A OUTPUT -j RETURN
# iptables -t nat -A hiddify --dport 2334 -j RETURN
# iptables -t mangle -A hiddify -d 10.0.0.0/8 -j RETURN
# iptables -t mangle -A hiddify -d 127.0.0.0/8 -j RETURN
# iptables -t mangle -A hiddify -d 169.254.0.0/16 -j RETURN
# iptables -t mangle -A hiddify -d 172.16.0.0/12 -j RETURN
# iptables -t mangle -A hiddify -d 192.168.50.0/16 -j RETURN
# iptables -t mangle -A hiddify -d 192.168.9.0/16 -j RETURN
# iptables -t mangle -A hiddify -d 224.0.0.0/4 -j RETURN
# iptables -t mangle -A hiddify -d 240.0.0.0/4 -j RETURN
# iptables -t mangle -A hiddify -p udp -j TPROXY --on-port 2334 --tproxy-mark 1
# iptables -t mangle -A hiddify -p tcp -j TPROXY --on-port 2334 --tproxy-mark 1
# # HIJACK ICMP (untested)
# # iptables -t mangle -A hiddify -p icmp -j DNAT --to-destination 127.0.0.1
# # REDIRECT
# iptables -t mangle -A PREROUTING -j hiddify
if [ -f "/opt/hiddify.json" ]; then
/hiddify/HiddifyCli run --config "$CONFIG" -h /hiddify/data/hiddify.json
else
/hiddify/HiddifyCli run --config "$CONFIG"
fi