innernet/docker-tests/Dockerfile.innernet

37 lines
1.5 KiB
Docker
Raw Normal View History

####################################################################################################
2021-09-18 07:15:29 +00:00
## 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
2021-05-19 18:16:28 +00:00
2021-09-18 07:15:29 +00:00
RUN mkdir /repo \
&& 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 \
&& CGO_ENABLED=0 make
2021-05-19 18:16:28 +00:00
####################################################################################################
## 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
2021-09-18 07:15:29 +00:00
COPY . .
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
COPY ./docker-tests/start-client.sh ./
COPY ./docker-tests/start-server.sh ./
2021-09-18 07:15:29 +00:00
COPY --from=wireguard /repo/wireguard-go /usr/bin/
CMD ["/app/start-server.sh"]