From 926835c2d52f0e400115556865233248f0882382 Mon Sep 17 00:00:00 2001 From: linus Date: Thu, 2 Dec 2021 17:42:02 +0100 Subject: [PATCH] change the way in which the .deb packages are built The build environment must be based on bullseye. This is achieved by using a docker container to build the .deb packages --- Dockerfile | 7 +++++++ build-binaries.sh | 18 ------------------ build-debs.sh | 25 +++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 Dockerfile delete mode 100755 build-binaries.sh create mode 100755 build-debs.sh 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