docker-wireguard/Dockerfile

57 lines
1.5 KiB
Docker
Raw Normal View History

2023-01-29 00:43:17 +00:00
# syntax=docker/dockerfile:1
2023-06-26 17:57:56 +00:00
FROM ghcr.io/linuxserver/baseimage-alpine:3.17
2020-03-31 03:59:44 +00:00
# set version label
ARG BUILD_DATE
ARG VERSION
ARG WIREGUARD_RELEASE
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
2023-04-26 08:50:27 +00:00
LABEL maintainer="thespad"
2020-03-31 03:59:44 +00:00
RUN \
echo "**** install dependencies ****" && \
2023-04-26 08:50:27 +00:00
apk add --no-cache --virtual=build-dependencies \
build-base \
elfutils-dev \
gcc \
git \
2023-04-26 08:50:27 +00:00
linux-headers && \
apk add --no-cache \
bc \
coredns \
gnupg \
2023-04-26 08:50:27 +00:00
grep \
iproute2 \
iptables \
2023-04-26 08:50:27 +00:00
ip6tables \
iputils \
libcap-utils \
libqrencode \
net-tools \
openresolv \
2023-04-26 08:50:27 +00:00
perl && \
echo "wireguard" >> /etc/modules && \
echo "**** install wireguard-tools ****" && \
if [ -z ${WIREGUARD_RELEASE+x} ]; then \
WIREGUARD_RELEASE=$(curl -sX GET "https://api.github.com/repos/WireGuard/wireguard-tools/tags" \
2023-04-26 08:50:27 +00:00
| jq -r .[0].name); \
fi && \
cd /app && \
git clone https://git.zx2c4.com/wireguard-tools && \
cd wireguard-tools && \
git checkout "${WIREGUARD_RELEASE}" && \
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|' src/wg-quick/linux.bash && \
make -C src -j$(nproc) && \
make -C src install && \
echo "**** clean up ****" && \
2023-04-26 08:50:27 +00:00
apk del --no-network build-dependencies && \
rm -rf \
2023-04-26 08:50:27 +00:00
/tmp/*
2020-03-31 03:59:44 +00:00
# add local files
COPY /root /
# ports and volumes
EXPOSE 51820/udp