This commit is contained in:
2025-11-20 22:17:24 +03:00
commit f0941b31a1
12 changed files with 599 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#Используем базовый образ с Alpine Linux для минимального размера
ARG ALPINE_VERSION=3.21
#--------------------------------Image--------------------------------
FROM alpine:${ALPINE_VERSION}
RUN set -ex; \
apk update && apk add --no-cache bash openrc openresolv iproute2 libqrencode p7zip
#Tun2Socks
RUN mkdir /opt/tun2socks/
COPY ./tun2socks/tun2socks-linux-amd64.7z /opt/tun2socks/tun2socks.7z
#Xray core
RUN mkdir /opt/xray/
RUN mkdir /opt/xray/config/
COPY ./xray-core/Xray-linux-64.7z /opt/xray/xray.7z
COPY ./start.sh /opt/start.sh
RUN chmod +x /opt/start.sh
RUN sed -i 's/\r//' /opt/start.sh
RUN sed -i 's/^tty/#tty/' /etc/inittab
ENTRYPOINT ["sh", "-c"]
CMD ["/bin/bash /opt/start.sh && /sbin/init"]
#https://github.com/XTLS/Xray-core
#https://github.com/xjasonlyu/tun2socks

26
Containers/Dockerfile_arm Normal file
View File

@@ -0,0 +1,26 @@
#Используем базовый образ с Alpine Linux для минимального размера
ARG ALPINE_VERSION=3.21
#--------------------------------Image--------------------------------
FROM alpine:${ALPINE_VERSION}
RUN set -ex; \
apk update && apk add --no-cache bash openrc openresolv iproute2 libqrencode p7zip
#Tun2Socks
RUN mkdir /opt/tun2socks/
COPY ./tun2socks/tun2socks-linux-armv7.7z /opt/tun2socks/tun2socks.7z
#Xray core
RUN mkdir /opt/xray/
RUN mkdir /opt/xray/config/
COPY ./xray-core/Xray-linux-arm32-v7a.7z /opt/xray/xray.7z
COPY ./start.sh /opt/start.sh
RUN chmod +x /opt/start.sh
RUN sed -i 's/\r//' /opt/start.sh
RUN sed -i 's/^tty/#tty/' /etc/inittab
ENTRYPOINT ["sh", "-c"]
CMD ["/bin/bash /opt/start.sh && /sbin/init"]
#https://github.com/XTLS/Xray-core
#https://github.com/xjasonlyu/tun2socks

View File

@@ -0,0 +1,26 @@
#Используем базовый образ с Alpine Linux для минимального размера
ARG ALPINE_VERSION=3.21
#--------------------------------Image--------------------------------
FROM alpine:${ALPINE_VERSION}
RUN set -ex; \
apk update && apk add --no-cache bash openrc openresolv iproute2 libqrencode p7zip
#Tun2Socks
RUN mkdir /opt/tun2socks/
COPY ./tun2socks/tun2socks-linux-arm64.7z /opt/tun2socks/tun2socks.7z
#Xray core
RUN mkdir /opt/xray/
RUN mkdir /opt/xray/config/
COPY ./xray-core/Xray-linux-arm64-v8a.7z /opt/xray/xray.7z
COPY ./start.sh /opt/start.sh
RUN chmod +x /opt/start.sh
RUN sed -i 's/\r//' /opt/start.sh
RUN sed -i 's/^tty/#tty/' /etc/inittab
ENTRYPOINT ["sh", "-c"]
CMD ["/bin/bash /opt/start.sh && /sbin/init"]
#https://github.com/XTLS/Xray-core
#https://github.com/xjasonlyu/tun2socks

41
Containers/start.sh Normal file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
echo "Starting setup container please wait"
sleep 1
SERVER_IP_ADDRESS=$(ping -c 1 $SERVER_ADDRESS | awk -F'[()]' '{print $2}')
if [ -z "$SERVER_IP_ADDRESS" ]; then
echo "Failed to obtain an IP address for FQDN $SERVER_ADDRESS"
echo "Please configure DNS on Mikrotik"
exit 1
fi
ip tuntap del mode tun dev tun0
ip tuntap add mode tun dev tun0
ip addr add 172.31.200.10/30 dev tun0
ip link set dev tun0 up
ip route del default via 172.18.20.5
ip route add default via 172.31.200.10
ip route add $SERVER_IP_ADDRESS/32 via 172.18.20.5
#ip route add 1.0.0.1/32 via 172.18.20.5
#ip route add 8.8.4.4/32 via 172.18.20.5
rm -f /etc/resolv.conf
tee -a /etc/resolv.conf <<< "nameserver 172.18.20.5"
#tee -a /etc/resolv.conf <<< "nameserver 1.0.0.1"
#tee -a /etc/resolv.conf <<< "nameserver 8.8.4.4"
echo "Xray and tun2socks preparing for launch"
rm -rf /tmp/xray/ && mkdir /tmp/xray/
7z x /opt/xray/xray.7z -o/tmp/xray/ -y
chmod 755 /tmp/xray/xray
rm -rf /tmp/tun2socks/ && mkdir /tmp/tun2socks/
7z x /opt/tun2socks/tun2socks.7z -o/tmp/tun2socks/ -y
chmod 755 /tmp/tun2socks/tun2socks
echo "Start Xray core"
/tmp/xray/xray run -config /opt/xray/config/config.json &
#pkill xray
echo "Start tun2socks"
/tmp/tun2socks/tun2socks -loglevel silent -tcp-sndbuf 3m -tcp-rcvbuf 3m -device tun0 -proxy socks5://127.0.0.1:10800 -interface eth0 &
#pkill tun2socks
echo "Container customization is complete"