Upload files
Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
54
Dockerfile
54
Dockerfile
@@ -1,26 +1,46 @@
|
|||||||
|
|
||||||
FROM alpine:3.19.2
|
ARG GOLANG_VERSION=1.24
|
||||||
|
ARG ALPINE_VERSION=3.21
|
||||||
|
|
||||||
ARG AWGTOOLS_RELEASE=1.0.20240213
|
# BUILD IMAGE
|
||||||
# ARG AWGTOOLS_RELEASE=1.0.20250706
|
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder
|
||||||
|
|
||||||
RUN apk --no-cache add iproute2 iptables bash && \
|
WORKDIR /go
|
||||||
cd /usr/bin/ && \
|
|
||||||
wget https://github.com/amnezia-vpn/amneziawg-tools/releases/download/v${AWGTOOLS_RELEASE}/alpine-3.19-amneziawg-tools.zip && \
|
RUN apk add --no-cache git make bash build-base linux-headers && \
|
||||||
unzip -j alpine-3.19-amneziawg-tools.zip && \
|
git clone --depth=1 https://github.com/amnezia-vpn/amneziawg-tools.git && \
|
||||||
chmod +x /usr/bin/awg /usr/bin/awg-quick && \
|
git clone --depth=1 https://github.com/amnezia-vpn/amneziawg-go.git && \
|
||||||
|
cd /go/amneziawg-tools/src && make && \
|
||||||
|
cd /go/amneziawg-go && make && \
|
||||||
|
mkdir -p /tmp/build/usr/bin/ && \
|
||||||
|
mv /go/amneziawg-go/amneziawg-go /tmp/build/usr/bin/amneziawg-go && \
|
||||||
|
mv /go/amneziawg-tools/src/wg /tmp/build/usr/bin/awg && \
|
||||||
|
mv /go/amneziawg-tools/src/wg-quick/linux.bash /tmp/build/usr/bin/awg-quick
|
||||||
|
|
||||||
|
|
||||||
|
# FINAL IMAGE
|
||||||
|
FROM alpine:${ALPINE_VERSION}
|
||||||
|
|
||||||
|
COPY --from=builder /tmp/build/ /
|
||||||
|
|
||||||
|
RUN apk --no-cache add iproute2 iptables bash openresolv dpkg dumb-init iptables-legacy && \
|
||||||
|
chmod +x /usr/bin/awg /usr/bin/awg-quick /usr/bin/amneziawg-go && \
|
||||||
ln -s /usr/bin/awg /usr/bin/wg && \
|
ln -s /usr/bin/awg /usr/bin/wg && \
|
||||||
ln -s /usr/bin/awg-quick /usr/bin/wg-quick
|
ln -s /usr/bin/awg-quick /usr/bin/wg-quick && \
|
||||||
|
|
||||||
# COPY /usr/bin/amneziawg-go /usr/bin/amneziawg-go
|
|
||||||
|
|
||||||
RUN apk add --no-cache openresolv dpkg dumb-init iptables-legacy && \
|
|
||||||
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 && \
|
|
||||||
mkdir /config && \
|
mkdir /config && \
|
||||||
mkdir -p /etc/amnezia/amneziawg
|
mkdir -p /etc/amnezia/amneziawg && \
|
||||||
|
# IPv4
|
||||||
|
rm /usr/sbin/iptables /usr/sbin/iptables-save /usr/sbin/iptables-restore && \
|
||||||
|
ln -s /usr/sbin/iptables-legacy /usr/sbin/iptables && \
|
||||||
|
ln -s /usr/sbin/iptables-legacy-save /usr/sbin/iptables-save && \
|
||||||
|
ln -s /usr/sbin/iptables-legacy-restore /usr/sbin/iptables-restore && \
|
||||||
|
# IPv6
|
||||||
|
rm /usr/sbin/ip6tables /usr/sbin/ip6tables-save /usr/sbin/ip6tables-restore && \
|
||||||
|
ln -s /usr/sbin/ip6tables-legacy /usr/sbin/ip6tables && \
|
||||||
|
ln -s /usr/sbin/ip6tables-legacy-save /usr/sbin/ip6tables-save && \
|
||||||
|
ln -s /usr/sbin/ip6tables-legacy-restore /usr/sbin/ip6tables-restore
|
||||||
|
|
||||||
COPY init.sh init.sh
|
COPY --chmod=775 init.sh init.sh
|
||||||
RUN chmod +x init.sh
|
|
||||||
|
|
||||||
HEALTHCHECK --interval=1m --timeout=5s --retries=3 CMD /usr/bin/timeout 5s /bin/sh -c \"awg show | grep interface || exit 1\"
|
HEALTHCHECK --interval=1m --timeout=5s --retries=3 CMD /usr/bin/timeout 5s /bin/sh -c \"awg show | grep interface || exit 1\"
|
||||||
ENTRYPOINT ["/usr/bin/dumb-init", "/init.sh"]
|
ENTRYPOINT ["/usr/bin/dumb-init", "/init.sh"]
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
services:
|
services:
|
||||||
awgtest:
|
amneziawg-client:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@@ -14,5 +14,5 @@ services:
|
|||||||
devices:
|
devices:
|
||||||
- /dev/net/tun:/dev/net/tun
|
- /dev/net/tun:/dev/net/tun
|
||||||
volumes:
|
volumes:
|
||||||
- ./config:/config
|
- ./config:/config:ro
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
Reference in New Issue
Block a user