Gapi / Dockerfile
dominiciao's picture
Update Dockerfile
531f14b verified
Raw History Blame
1.29 kB
FROM alpine:latest
RUN set -ex && apk add --no-cache curl tar
ADD https://git.new/wcgo /usr/local/bin/wgcf
RUN chmod +x /usr/local/bin/wgcf
ADD https://git.new/wpgo /tmp/wpgo.tar.gz
RUN tar -xzf /tmp/wpgo.tar.gz -C /tmp && \
mv /tmp/wireproxy /usr/local/bin/wpgo && \
chmod +x /usr/local/bin/wpgo && \
rm -rf /tmp/*
WORKDIR /config
RUN wgcf register --accept-tos >/dev/null 2>&1 && wgcf generate >/dev/null 2>&1
COPY api-server /app/api-server
RUN chmod +x /app/api-server
WORKDIR /app
EXPOSE 7860
RUN cat > /start.sh << 'EOF'
#!/bin/sh
cat > /wpgo.conf <<EOC 2>/dev/null
[Interface]
Address = $(grep -m1 Address /config/wgcf-profile.conf | cut -d' ' -f3)
DNS = 1.1.1.1
MTU = 1280
PrivateKey = $(grep PrivateKey /config/wgcf-profile.conf | cut -d' ' -f3)
[Peer]
PublicKey = $(grep PublicKey /config/wgcf-profile.conf | cut -d' ' -f3)
Endpoint = 162.159.192.1:2408
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
[SOCKS5]
BindAddress = 127.0.0.1:1080
EOC
wpgo -c /wpgo.conf >/dev/null 2>&1 &
sleep 3
echo "{\"server_host\":\"0.0.0.0\",\"server_port\":7860,\"server_key\":\"${SERVER_KEY}\",\"upstream_server\":\"socks5://127.0.0.1:1080\"}" >/dev/null 2>&1 > config.json
exec ./api-server -config config.json >/dev/null 2>&1
EOF
RUN chmod +x /start.sh
CMD ["/start.sh"]