w0rng / amnezia-wg-easy

The easiest way to run WireGuard VPN + Web-based Admin UI.
Other
124 stars 16 forks source link

Support more CPU architectures #10

Open jakeweary opened 1 month ago

jakeweary commented 1 month ago

The ghcr page says arm64 is supported but it's not the case. It seems the issue is that amneziavpn/amnezia-wg is being used as the base image, which doesn't support anything but amd64.

I spent quite some time today trying to make amnezia-wg-easy work on my arm64 server, figuring out what exactly is needed, building and etc. But fear not, now you don't have to do it yourself! So, here is the Dockerfile I ended up using in my compose config.

Someone needs to adapt it a little bit to make a proper PR, I might do it later myself if I find some time.

FROM alpine AS build-go
RUN apk add --no-cache git go make
RUN git clone https://github.com/amnezia-vpn/amneziawg-go.git
RUN cd amneziawg-go && make

FROM alpine AS build-c
RUN apk add --no-cache git build-base linux-headers
RUN git clone https://github.com/amnezia-vpn/amneziawg-tools.git
RUN cd amneziawg-tools/src && make

FROM alpine AS build-node
RUN apk add --no-cache git npm
RUN git clone https://github.com/w0rng/amnezia-wg-easy.git
RUN cd amnezia-wg-easy/src && npm ci --omit=dev

# ---

FROM alpine AS run
RUN apk add --no-cache bash nodejs dpkg iptables iptables-legacy
RUN update-alternatives \
  --install /sbin/iptables iptables /sbin/iptables-legacy 10 \
  --slave /sbin/iptables-restore iptables-restore /sbin/iptables-legacy-restore \
  --slave /sbin/iptables-save iptables-save /sbin/iptables-legacy-save

COPY --from=build-go /amneziawg-go/amneziawg-go /usr/local/bin
COPY --from=build-c /amneziawg-tools/src/wg /usr/local/bin
COPY --from=build-c /amneziawg-tools/src/wg-quick/linux.bash /usr/local/bin/wg-quick
RUN mkdir /etc/amnezia && ln -s /etc/wireguard /etc/amnezia/amneziawg
RUN ln -s wg /usr/local/bin/awg

COPY --from=build-node /amnezia-wg-easy/src/wgpw.sh /usr/local/bin/wgpw
COPY --from=build-node /amnezia-wg-easy/src /app

WORKDIR /app
ENV DEBUG=Server,WireGuard
CMD ["node", "server.js"]