From 6119e3bd24beec7dcc51dc22f5aef6221c14c583 Mon Sep 17 00:00:00 2001 From: yeastplume Date: Wed, 13 Nov 2024 13:09:08 +0000 Subject: [PATCH] add snap definition to devcontainer + snapcraft file --- .devcontainer/Dockerfile | 17 +++++++++++++++++ .devcontainer/devcontainer.json | 3 ++- .packaging/snaps/snapcraft.yaml | 27 +++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .packaging/snaps/snapcraft.yaml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 8067909b4..3286c000a 100755 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -4,3 +4,20 @@ FROM mcr.microsoft.com/devcontainers/rust:latest # Install Required Dependencies RUN apt-get -qq update RUN apt-get install -y build-essential cmake git libgit2-dev clang libncurses5-dev libncursesw5-dev zlib1g-dev pkg-config libssl-dev llvm + +# Install snapd and its dependencies +RUN apt-get install -y snapd fuse squashfuse sudo gh + +# Create a script to start snapd +RUN echo '#!/bin/bash\n\ +/usr/lib/snapd/snapd &\n\ +sleep 5\n\ +exec "$@"' > /start-snapd.sh && \ + chmod +x /start-snapd.sh + + +VOLUME ["/sys/fs/cgroup"] + +# Use the script as the entry point +ENTRYPOINT ["/start-snapd.sh"] +CMD ["bash"] \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index ba8003bdd..fe05b995e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -16,5 +16,6 @@ "github.copilot-chat" ] } - } + }, + "runArgs": ["--privileged", "-v", "/sys/fs/cgroup:/sys/fs/cgroup:ro", "-v", "/tmp:/tmp"] } \ No newline at end of file diff --git a/.packaging/snaps/snapcraft.yaml b/.packaging/snaps/snapcraft.yaml new file mode 100644 index 000000000..a08795316 --- /dev/null +++ b/.packaging/snaps/snapcraft.yaml @@ -0,0 +1,27 @@ +name: grin +version: v5.1.0 +summary: Minimal implementation of the Mimblewimble protocol +description: | + https://grin.mw/ + +epoch: 3* +confinement: strict +grade: stable +base: core18 +parts: + grin: + plugin: rust + source: https://github.com/mimblewimble/grin.git + source-tag: v5.1.0 + build-packages: + - clang + - libncurses5-dev + - libncursesw5-dev + +apps: + grin: + environment: + LC_ALL: C.UTF-8 + LANG: C.UTF-8 + command: bin/grin + plugs: [network, network-bind] \ No newline at end of file