diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b0427f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM rust:slim-bullseye + +RUN cargo install cargo-deb +RUN apt-get update +RUN apt-get install -y libsqlite3-dev libclang-dev +RUN mkdir -p /innernet +WORKDIR /innernet diff --git a/build-binaries.sh b/build-binaries.sh deleted file mode 100755 index 79f1e7f..0000000 --- a/build-binaries.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -# Go to innernet-src submodule -cd innernet-src || exit - -# Checkout correct version -git checkout "${INNERNET_VERSION}" - -# Build binaries -cargo build --release --bin innernet -cargo build --release --bin innernet-server - -# Copy binaries to Ansible roles -mkdir -p ./roles/server/files && \ - cp target/release/innernet ../roles/server/files/innernet-server - -mkdir -p ./roles/client/files && \ - cp target/release/innernet ../roles/client/files/innernet diff --git a/build-debs.sh b/build-debs.sh new file mode 100755 index 0000000..f5fef98 --- /dev/null +++ b/build-debs.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# build needed Docker container +docker build . -t rust-deb:bullseye + +# Go to innernet-src submodule +cd innernet-src || exit + +INNERNET_VERSION="${INNERNET_VERSION:-1.5.1}" + +# Checkout correct version +git checkout "v${INNERNET_VERSION}" + +# Build binaries +echo "Building binaries" +docker run --rm -v $PWD:/innernet rust-deb:bullseye cargo deb -p client +docker run --rm -v $PWD:/innernet rust-deb:bullseye cargo deb -p server + +# Copy binaries to Ansible roles +echo "Copying binaries" +mkdir -p ./roles/server/files && \ + cp target/debian/innernet-server_"$INNERNET_VERSION"_amd64.deb ../roles/server/files/innernet-server.deb + +mkdir -p ./roles/client/files && \ + cp target/debian/innernet_"$INNERNET_VERSION"_amd64.deb ../roles/client/files/innernet.deb