From 7b7c6aa7fb6512248176e26733ececf3f0be9eaf Mon Sep 17 00:00:00 2001 From: Richard Ulrich Date: Fri, 20 Jan 2023 17:14:22 +0100 Subject: [PATCH] building a simple debian package --- .dockerignore | 2 ++ .gitignore | 1 + Cargo.toml | 7 +++++++ contrib/Dockerfile | 26 ++++++++++++++++++++++++++ contrib/deb.sh | 10 ++++++++++ contrib/gossip.desktop | 17 +++++++++++++++++ 6 files changed, 63 insertions(+) create mode 100644 .dockerignore create mode 100644 contrib/Dockerfile create mode 100755 contrib/deb.sh create mode 100644 contrib/gossip.desktop diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..c576540c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +/target +/contrib/*.deb diff --git a/.gitignore b/.gitignore index ea8c4bf7..c576540c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +/contrib/*.deb diff --git a/Cargo.toml b/Cargo.toml index 4d4815e0..2b0b5934 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,3 +49,10 @@ zeroize = "1.5" opt-level = 3 debug-assertions = false overflow-checks = false + +[package.metadata.deb] +section = "web" +assets = [ + ["target/release/gossip", "/usr/bin/", "755"], + ["contrib/gossip.desktop", "/usr/share/applications/gossip.desktop", "644"], +] diff --git a/contrib/Dockerfile b/contrib/Dockerfile new file mode 100644 index 00000000..4e0b48b1 --- /dev/null +++ b/contrib/Dockerfile @@ -0,0 +1,26 @@ +FROM rust:1.65-bullseye as builder + +RUN apt-get update \ + && apt-get install --no-install-recommends -y \ + build-essential \ + ca-certificates \ + curl \ + libfontconfig1-dev \ + libssl-dev \ + pkg-config \ + sudo \ + && apt -y autoremove \ + && apt clean \ + && rm -rf /var/lib/apt/lists/* +RUN cargo install cargo-deb + + +# Build gossip +COPY ./ gossip/ +WORKDIR gossip +RUN mkdir -p /gossip/artifacts +RUN cargo deb +RUN ls /gossip/target/debian/ + +FROM scratch as custom-exporter +COPY --from=builder /gossip/target/debian/gossip*_amd64.deb . diff --git a/contrib/deb.sh b/contrib/deb.sh new file mode 100755 index 00000000..0726348e --- /dev/null +++ b/contrib/deb.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +cd $SCRIPT_DIR/.. +DOCKER_BUILDKIT=1 \ + docker build \ + --output contrib \ + -f contrib/Dockerfile \ + . + diff --git a/contrib/gossip.desktop b/contrib/gossip.desktop new file mode 100644 index 00000000..73a9aa9b --- /dev/null +++ b/contrib/gossip.desktop @@ -0,0 +1,17 @@ +[Desktop Entry] +Name=gossip +Version=1.0 +Comment=Desktop client for Nostr +Exec=gossip +Icon=gossip +Type=Application +Categories=Network;InstantMessaging; +StartupWMClass=gossip +Terminal=false +MimeType=x-scheme-handler/nostr; +X-GNOME-UsesNotifications=false +# Allows finding Gossip using application launchers and software shops more easily +Keywords=Nostr +X-KDE-Keywords=Nostr +# to be listed properly in some stores +X-Purism-FormFactor=Workstation;Mobile;