diff --git a/docker-tests/Dockerfile.innernet b/docker-tests/Dockerfile.innernet index 4b648ed..a3cb265 100644 --- a/docker-tests/Dockerfile.innernet +++ b/docker-tests/Dockerfile.innernet @@ -1,47 +1,34 @@ #################################################################################################### -## Builder +## WireGuard #################################################################################################### -FROM rust:slim as builder -RUN apt-get update && \ - apt-get install -y --no-install-recommends build-essential clang libclang-dev libsqlite3-dev -WORKDIR /app - -COPY . . -RUN cargo build -RUN strip /app/target/debug/innernet /app/target/debug/innernet-server - FROM golang:latest as wireguard ARG wg_go_tag=0.0.20210323 ARG wg_tools_tag=v1.0.20210315 -RUN apt-get update && \ - apt-get install -y --no-install-recommends git -RUN git clone -b $wg_go_tag --depth 1 https://git.zx2c4.com/wireguard-go && \ - cd wireguard-go && \ - make && \ - make install - -ENV WITH_WGQUICK=yes -RUN git clone -b $wg_tools_tag --depth 1 https://git.zx2c4.com/wireguard-tools && \ - cd wireguard-tools && \ - cd src && \ - make && \ - make install +RUN mkdir /repo \ + && curl -L https://github.com/WireGuard/wireguard-go/archive/refs/tags/0.0.20210424.tar.gz \ + | tar -xzC /repo --strip-components=1 \ + && cd /repo \ + && make #################################################################################################### ## Final image #################################################################################################### -FROM debian:buster-slim +FROM rust:slim RUN apt-get update && \ - apt-get install -y --no-install-recommends libsqlite3-dev iproute2 iputils-ping && \ + apt-get install -y --no-install-recommends libsqlite3-dev iproute2 iputils-ping build-essential clang libclang-dev && \ rm -rf /var/lib/apt/lists/* WORKDIR /app +COPY . . +RUN cargo build \ + && 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 /usr/bin/wireguard-go /usr/bin/wg* /usr/bin/ -COPY --from=builder /app/target/debug/innernet /usr/bin/ -COPY --from=builder /app/target/debug/innernet-server /usr/bin/ +COPY --from=wireguard /repo/wireguard-go /usr/bin/ CMD ["/app/start-server.sh"] diff --git a/docker-tests/run-docker-tests.sh b/docker-tests/run-docker-tests.sh index 1b61c26..898047a 100755 --- a/docker-tests/run-docker-tests.sh +++ b/docker-tests/run-docker-tests.sh @@ -60,7 +60,7 @@ cmd docker start -a "$SERVER_CONTAINER" & info "server started as $SERVER_CONTAINER" info "Waiting for server to initialize." -cmd sleep 10 +cmd sleep 5 info "Starting first peer." cmd docker cp "$SERVER_CONTAINER:/app/peer1.toml" "$tmp_dir" @@ -125,11 +125,11 @@ cmd docker exec "$PEER1_CONTAINER" innernet \ --admin false \ --ip "10.66.2.100" \ --save-config "/app/peer3.toml" \ - --invite-expires "5s" \ + --invite-expires "1s" \ --yes info "waiting 15 seconds to see if the server clears out the IP address." -sleep 15 +sleep 11 info "Re-requesting invite after expiration with the same parameters." cmd docker exec "$PEER1_CONTAINER" innernet \