-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathDockerfile.wgtools
58 lines (48 loc) · 1.98 KB
/
Dockerfile.wgtools
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM --platform=$BUILDPLATFORM golang:latest as gobuilder
ARG TARGETOS TARGETARCH
ARG wg_go_tag=bb719d3a6e2cd20ec00f26d65c0073c1dde6b529
RUN apt-get update && apt-get install git -y
# Build wireguard-go
RUN git clone https://git.zx2c4.com/wireguard-go && \
cd wireguard-go && \
git checkout $wg_go_tag && \
make && \
GOOS=$TARGETOS GOARCH=$TARGETARCH make install
# Build boringtun
# FROM ${ARCH}rust:slim as rust-builder
# ARG boringtun_ver=0.5.2
# RUN cargo install boringtun-cli --version $boringtun_ver
# Final image
FROM ubuntu:jammy
ARG wg_tools_tag=139aac59a5ab7da913d4b6dd62692fa90e2ccad4
RUN set -eux \
&& echo 'APT::Install-Recommends "false";' >/etc/apt/apt.conf.d/00recommends \
&& echo 'APT::Install-Suggests "false";' >>/etc/apt/apt.conf.d/00recommends \
&& echo 'APT::Get::Install-Recommends "false";' >>/etc/apt/apt.conf.d/00recommends \
&& echo 'APT::Get::Install-Suggests "false";' >>/etc/apt/apt.conf.d/00recommends \
&& apt-get -qq update \
# install essentials
&& apt-get install -y \
bash ca-certificates dnsutils iptables openresolv iproute2 curl build-essential git \
&& mkdir /app && cd /app \
# for dynamic compile in init-wireguard-module.sh
&& git clone https://git.zx2c4.com/wireguard-linux-compat \
# compile wireguard-tools in the final image to make sure arch matches
# TODO: figure out how to cross compile
&& git clone https://git.zx2c4.com/wireguard-tools \
&& cd wireguard-tools \
&& git checkout $wg_tools_tag \
&& make -C src -j$(nproc) \
&& make -C src install \
# clean up
&& apt-get remove -y \
build-essential git \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/
COPY --from=gobuilder /go/bin/* /usr/bin/wireguard-go /usr/bin/
#COPY --from=rust-builder /usr/local/cargo/bin/boringtun-cli /usr/bin/