37 lines
1.5 KiB
Docker
37 lines
1.5 KiB
Docker
####################################################################################################
|
|
## WireGuard
|
|
####################################################################################################
|
|
|
|
# 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
|
|
ARG wg_go_tag=0.0.20230223
|
|
|
|
RUN mkdir /repo \
|
|
&& curl -L https://github.com/WireGuard/wireguard-go/archive/refs/tags/${wg_go_tag}.tar.gz \
|
|
| tar -xzC /repo --strip-components=1 \
|
|
&& cd /repo \
|
|
&& CGO_ENABLED=0 make
|
|
|
|
####################################################################################################
|
|
## Final image
|
|
####################################################################################################
|
|
FROM rust:slim-bookworm
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends libsqlite3-dev iproute2 iputils-ping build-essential clang libclang-dev libselinux1-dev && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
RUN cargo build --features client/selinux \
|
|
&& strip /app/target/debug/innernet /app/target/debug/innernet-server \
|
|
&& cp /app/target/debug/innernet /app/target/debug/innernet-server /usr/bin/ \
|
|
&& cargo clean
|
|
|
|
COPY ./docker-tests/start-client.sh ./
|
|
COPY ./docker-tests/start-server.sh ./
|
|
COPY --from=wireguard /repo/wireguard-go /usr/bin/
|
|
|
|
CMD ["/app/start-server.sh"]
|