diff --git a/Dockerfile b/Dockerfile index ec13787..5abeb38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,11 +8,15 @@ WORKDIR /app COPY . . RUN cargo build --release --target x86_64-unknown-linux-musl +# amnezia +FROM ghcr.io/arian8j2/wireguard:amnezia as amnezia + # runner FROM alpine:3.19.2 COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/uptime-reporter /bin/uptime-reporter +COPY --from=amnezia /bin/wg-quick /bin/wg /bin/wireguard-go /bin -RUN apk add --no-cache curl iputils-ping wireguard-tools +RUN apk add --no-cache curl iputils-ping VOLUME /app WORKDIR /app diff --git a/src/wireguard.rs b/src/wireguard.rs index 3d884ae..c36875e 100644 --- a/src/wireguard.rs +++ b/src/wireguard.rs @@ -13,7 +13,7 @@ pub async fn create_interface(name: &str) -> anyhow::Result<()> { .await .with_context(|| format!("couldn't read config file at {config_file_path}"))?; - utils::run_command("ip", &["link", "add", name, "type", "wireguard"]).await?; + utils::run_command("wireguard-go", &[name]).await?; // stripped version of common config is needed because `wg setconf` doesn't accept many usual // attributes like `MTU`, `DNS`, `Address` and ...