1- FROM --platform=$BUILDPLATFORM alpine:3.23 AS build
1+ FROM --platform=$BUILDPLATFORM alpine:3.23
22ARG BUILDPLATFORM=linux/amd64
33ARG GOST_VERSION=3.1.0
44
5- # Install debug tools
6- RUN apk add --no-cache curl
7-
8- # Install dotnet dependencies
9- RUN apk add --no-cache icu-libs icu-data-full
10-
11- # Install WireGuard dependencies + setup
12- RUN apk add --no-cache iproute2 iptables ip6tables openresolv wireguard-tools && \
5+ # Install required tools, dotnet dependencies and wireguard dependencies + fixes
6+ RUN apk add --no-cache curl \
7+ icu-libs icu-data-full \
8+ iproute2 iptables ip6tables openresolv wireguard-tools && \
139 echo "wireguard" >> /etc/modules && \
14- sed -i 's|\[\[ $proto == -4 \]\] && cmd sysctl -q net\. ipv4\. conf\. all\. src_valid_mark=1|[[ $proto == -4 ]] \&\& [[ $(sysctl -n net.ipv4.conf.all.src_valid_mark) != 1 ]] \&\& cmd sysctl -q net.ipv4.conf.all.src_valid_mark=1|' /usr/bin/wg-quick
15-
16- # Add GostGen for config file generation
17- COPY GostGen/publish/${BUILDPLATFORM} .
18- RUN chmod a+x /GostGen
10+ sed -i 's|\[\[ $proto == -4 \]\] && cmd sysctl -q net\. ipv4\. conf\. all\. src_valid_mark=1|[[ $proto == -4 ]] \&\& [[ $(sysctl -n net.ipv4.conf.all.src_valid_mark) != 1 ]] \&\& cmd sysctl -q net.ipv4.conf.all.src_valid_mark=1|' /usr/bin/wg-quick && \
11+ rm -rf /tmp/* /var/tmp/* /var/cache/distfiles/*
1912
20- # Download and add ghost (https://github.com/go-gost/gost)
13+ # Download and add ghost binary (https://github.com/go-gost/gost) for socks5 proxy server
2114RUN set -eux; \
22- apk add --no-cache --virtual .fetch-deps tar; \
15+ apk add --no-cache --virtual .fetch-deps wget tar; \
2316 case "${BUILDPLATFORM}" in \
2417 "linux/amd64" ) GOST_ARCH="linux_amd64" ;; \
2518 "linux/arm/v7" ) GOST_ARCH="linux_armv7" ;; \
@@ -29,26 +22,17 @@ RUN set -eux; \
2922 esac; \
3023 wget -qO /tmp/gost.tar.gz "https://github.com/go-gost/gost/releases/download/v${GOST_VERSION}/gost_${GOST_VERSION}_${GOST_ARCH}.tar.gz" ; \
3124 tar -xzf /tmp/gost.tar.gz -C /; \
32- rm -f /tmp/ gost.tar.gz ; \
25+ chmod a+x / gost; \
3326 apk del .fetch-deps; \
34- chmod a+x /gost;
27+ rm -rf /tmp/* /var/tmp/* /var/cache/distfiles/*;
28+
3529
36- # Cleanup
37- RUN rm -rf /root/.cache && mkdir -p /root/.cache && \
38- rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
30+ # Add project binaries
31+ COPY --chmod=755 run.sh /run.sh
32+ COPY --chmod=755 GostGen/publish/${BUILDPLATFORM} .
3933
40- # Healthcheck
4134HEALTHCHECK --interval=15s --timeout=5s --retries=3 --start-period=10s CMD \
4235 sh -c "curl -fs https://am.i.mullvad.net/json | grep -q '\" mullvad_exit_ip\" :true'"
4336
44- # Add run script
45- COPY run.sh /run.sh
46- RUN chmod a+x /run.sh
47-
48- LABEL org.opencontainers.image.source=https://github.com/ChrSchu90/MullvadProxyGateway
49- LABEL org.opencontainers.image.description="Turn single a Mullvad WireGuard client into a powerful, reusable proxy gateway. Route traffic from any device through it and connect seamlessly to any Mullvad provided city worldwide."
50- LABEL org.opencontainers.image.licenses=MIT
51-
5237VOLUME ["/data" ]
53-
54- CMD [ "/run.sh" ]
38+ CMD [ "/run.sh" ]
0 commit comments