From 9af862d56c09b681344b155382415a54aae281e7 Mon Sep 17 00:00:00 2001 From: Walter Oggioni Date: Mon, 11 Aug 2025 20:32:32 +0800 Subject: [PATCH] added swarm-cli image --- .gitea/workflows/build-swarm-cli.yaml | 41 +++++++++++++++++++++++++++ swarm-cli/Dockerfile | 12 ++++++++ swarm-cli/config.nu | 40 ++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 .gitea/workflows/build-swarm-cli.yaml create mode 100644 swarm-cli/Dockerfile create mode 100644 swarm-cli/config.nu diff --git a/.gitea/workflows/build-swarm-cli.yaml b/.gitea/workflows/build-swarm-cli.yaml new file mode 100644 index 0000000..210a10d --- /dev/null +++ b/.gitea/workflows/build-swarm-cli.yaml @@ -0,0 +1,41 @@ +name: CI +on: + push: + branches: [ master ] + paths: + - 'swarm-cli/*' + - '.gitea/workflows/build-swarm-cli.yaml' +jobs: + "Build swarm-cli docker images": + runs-on: woryzen + steps: + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.4.0 + with: + driver: docker-container + platforms: | + linux/amd64 + linux/arm64 + - + name: Login to Gitea container registry + uses: docker/login-action@v3 + with: + registry: gitea.woggioni.net + username: woggioni + password: ${{ secrets.PUBLISHER_TOKEN }} + - + name: Build and push sserver-rust images + uses: docker/build-push-action@v6 + with: + context: "{{defaultContext}}:rlevtree" + platforms: | + linux/amd64 + linux/arm64 + push: true + pull: true + tags: | + "gitea.woggioni.net/woggioni/swarm-cli:latest" + cache-from: type=registry,ref=gitea.woggioni.net/woggioni/swarm-cli:buildx + cache-to: type=registry,mode=max,compression=zstd,image-manifest=true,oci-mediatypes=true,ref=gitea.woggioni.net/woggioni/swarm-cli:buildx + diff --git a/swarm-cli/Dockerfile b/swarm-cli/Dockerfile new file mode 100644 index 0000000..173922d --- /dev/null +++ b/swarm-cli/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:3.22 + +RUN --mount=type=cache,target=/var/cache/apk apk update +RUN --mount=type=cache,target=/var/cache/apk apk add nodejs npm nushell curl +RUN npm install --global @ethersphere/swarm-cli +RUN addgroup -S ethswarm +RUN adduser -D -S -h /var/lib/ethswarm -s /usr/bin/nu -G ethswarm ethswarm +USER ethswarm +ADD config.nu /var/lib/ethswarm/.config/nushell/config.nu +ENTRYPOINT ["/usr/bin/nu"] + + diff --git a/swarm-cli/config.nu b/swarm-cli/config.nu new file mode 100644 index 0000000..41e950e --- /dev/null +++ b/swarm-cli/config.nu @@ -0,0 +1,40 @@ +# config.nu +# +# Installed by: +# version = "0.104.1" +# +# This file is used to override default Nushell settings, define +# (or import) custom commands, or run any other startup tasks. +# See https://www.nushell.sh/book/configuration.html +# +# This file is loaded after env.nu and before login.nu +# +# You can open this file in your default editor using: +# config nu +# +# See `help config nu` for more options +# +# You can remove these comments if you want or leave +# them for future reference. + +use std/util "path add" + +path add ($env.HOME | path join "bin") +path add ($env.HOME | path join ".local/bin") +path add ($env.HOME | path join ".cargo/bin") + +$env.config.show_banner = false +$env.config.history.max_size = 10000 + +$env.PROMPT_COMMAND = { || + let username = $env.USER + let hostname = sys host | get hostname + let current_dir = (pwd) + + $"($username)@($hostname) ($current_dir)" +} + +def --env mkcd [p: string] { + mkdir $p + cd $p +}