2021-04-19 12:56:18 +00:00
|
|
|
####################################################################################################
|
2021-09-18 07:15:29 +00:00
|
|
|
## WireGuard
|
2021-04-19 12:56:18 +00:00
|
|
|
####################################################################################################
|
2024-09-13 10:13:41 +00:00
|
|
|
|
|
|
|
# Pin go 1.22 as the latest tag of wireguard-go (0.0.20230223) doesn't build with go 1.23+ due to
|
|
|
|
# its outdated x/net dependency. We can use latest go once they release newer version.
|
|
|
|
FROM golang:1.22-bookworm as wireguard
|
2023-08-23 06:45:32 +00:00
|
|
|
ARG wg_go_tag=0.0.20230223
|
2021-05-19 18:16:28 +00:00
|
|
|
|
2021-09-18 07:15:29 +00:00
|
|
|
RUN mkdir /repo \
|
2024-09-13 10:00:33 +00:00
|
|
|
&& curl -L https://github.com/WireGuard/wireguard-go/archive/refs/tags/${wg_go_tag}.tar.gz \
|
2021-09-18 07:15:29 +00:00
|
|
|
| tar -xzC /repo --strip-components=1 \
|
|
|
|
&& cd /repo \
|
2023-08-23 06:45:32 +00:00
|
|
|
&& CGO_ENABLED=0 make
|
2021-05-19 18:16:28 +00:00
|
|
|
|
2021-04-19 12:56:18 +00:00
|
|
|
####################################################################################################
|
|
|
|
## Final image
|
|
|
|
####################################################################################################
|
2023-08-23 06:45:32 +00:00
|
|
|
FROM rust:slim-bookworm
|
2021-06-09 18:27:38 +00:00
|
|
|
RUN apt-get update && \
|
2024-07-01 01:16:43 +00:00
|
|
|
apt-get install -y --no-install-recommends libsqlite3-dev iproute2 iputils-ping build-essential clang libclang-dev libselinux1-dev && \
|
2021-06-09 18:27:38 +00:00
|
|
|
rm -rf /var/lib/apt/lists/*
|
2021-04-19 12:56:18 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2021-09-18 07:15:29 +00:00
|
|
|
COPY . .
|
2024-07-01 01:16:43 +00:00
|
|
|
RUN cargo build --features client/selinux \
|
2021-09-18 07:15:29 +00:00
|
|
|
&& strip /app/target/debug/innernet /app/target/debug/innernet-server \
|
|
|
|
&& cp /app/target/debug/innernet /app/target/debug/innernet-server /usr/bin/ \
|
|
|
|
&& cargo clean
|
|
|
|
|
2021-04-19 12:56:18 +00:00
|
|
|
COPY ./docker-tests/start-client.sh ./
|
2021-09-15 13:57:48 +00:00
|
|
|
COPY ./docker-tests/start-server.sh ./
|
2021-09-18 07:15:29 +00:00
|
|
|
COPY --from=wireguard /repo/wireguard-go /usr/bin/
|
2021-04-19 12:56:18 +00:00
|
|
|
|
2021-09-15 13:57:48 +00:00
|
|
|
CMD ["/app/start-server.sh"]
|