Upload files

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2025-08-13 13:56:32 +07:00
parent 85f50360b2
commit 9c8194cb1a
3 changed files with 43 additions and 20 deletions

View File

@@ -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
# ARG AWGTOOLS_RELEASE=1.0.20250706
# BUILD IMAGE
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder
RUN apk --no-cache add iproute2 iptables bash && \
cd /usr/bin/ && \
wget https://github.com/amnezia-vpn/amneziawg-tools/releases/download/v${AWGTOOLS_RELEASE}/alpine-3.19-amneziawg-tools.zip && \
unzip -j alpine-3.19-amneziawg-tools.zip && \
chmod +x /usr/bin/awg /usr/bin/awg-quick && \
WORKDIR /go
RUN apk add --no-cache git make bash build-base linux-headers && \
git clone --depth=1 https://github.com/amnezia-vpn/amneziawg-tools.git && \
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-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 && \
ln -s /usr/bin/awg-quick /usr/bin/wg-quick && \
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
RUN chmod +x init.sh
COPY --chmod=775 init.sh init.sh
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"]

View File

@@ -1,5 +1,5 @@
services:
awgtest:
amneziawg-client:
build:
context: .
dockerfile: Dockerfile
@@ -14,5 +14,5 @@ services:
devices:
- /dev/net/tun:/dev/net/tun
volumes:
- ./config:/config
restart: unless-stopped
- ./config:/config:ro
restart: unless-stopped

View File

@@ -22,3 +22,6 @@ if [[ $COUNTER -lt 1 ]]
then
echo "There are no config files in the /config folder"
fi
/bin/sh