58 lines
1.5 KiB
Docker
58 lines
1.5 KiB
Docker
FROM rust:1.33-slim AS rustbuild
|
|
|
|
FROM rustbuild AS eventbuild
|
|
|
|
WORKDIR /build
|
|
|
|
RUN rustup target add x86_64-unknown-linux-musl
|
|
|
|
COPY wg-event-gen/Cargo.* /build/
|
|
|
|
RUN mkdir -p src && echo "fn main() {}" > src/main.rs && cargo build --release --target x86_64-unknown-linux-musl
|
|
|
|
COPY wg-event-gen/ /build
|
|
|
|
RUN cargo build --target x86_64-unknown-linux-musl
|
|
|
|
FROM frolvlad/alpine-glibc AS test
|
|
|
|
COPY --from=eventbuild /build/target/x86_64-unknown-linux-musl/debug/wg-event-gen /usr/bin/
|
|
|
|
RUN echo "d41d8cd98f00b204e9800998ecf8427e -" > test.md5 && wg-event-gen | md5sum -c test.md5
|
|
|
|
FROM rustbuild AS boringbuild
|
|
|
|
WORKDIR /build
|
|
|
|
RUN rustup target add x86_64-unknown-linux-musl
|
|
|
|
COPY boringtun/Cargo.* /build/
|
|
|
|
RUN mkdir -p src && echo "fn main() {}" > src/main.rs && touch src/lib.rs && cargo build --release #--target x86_64-unknown-linux-musl #Ring won't compile https://github.com/briansmith/ring/issues/713
|
|
|
|
COPY boringtun/ /build
|
|
|
|
RUN cargo build --release #--target x86_64-unknown-linux-musl
|
|
|
|
|
|
FROM frolvlad/alpine-glibc
|
|
|
|
RUN echo http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && apk --no-cache add wireguard-tools bash nload
|
|
|
|
ENV WG_I_PREFER_BUGGY_USERSPACE_TO_POLISHED_KMOD=1
|
|
|
|
COPY --from=eventbuild /build/target/x86_64-unknown-linux-musl/debug/wg-event-gen /usr/bin/
|
|
|
|
COPY --from=boringbuild /build/target/release/boringtun /usr/bin/
|
|
|
|
COPY init.sh /init.sh
|
|
|
|
RUN chmod +x /init.sh && echo 'alias nload="nload ${WG_INTERFACE:-wg0}"' >> /root/.bashrc
|
|
|
|
VOLUME /etc/wireguard/
|
|
|
|
EXPOSE 51820/udp
|
|
|
|
ENTRYPOINT /init.sh
|
|
|