From 6e4777827ca2dd21681fb9ac123702b9ea1f1bd0 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 03:12:20 -0400 Subject: [PATCH 01/23] Added `devcontrainer` test for `neo-cli` --- .github/workflows/devcontainer.yml | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/devcontainer.yml diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml new file mode 100644 index 0000000000..6c0be8aeb1 --- /dev/null +++ b/.github/workflows/devcontainer.yml @@ -0,0 +1,31 @@ +name: Test (neo-cli) + +on: + push: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout (GitHub) + uses: actions/checkout@v4 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and run Dev Container task + uses: devcontainers/ci@v0.3 + with: + # Change this to point to your image name + imageName: ghcr.io/${{ github.repository_owner }}/neo:latest + # Change this to be your CI task/script + runCmd: | + # Add multiple commands to run if needed + apt-get update && apt-get install -y libleveldb-dev + dotnet test From ddc33da0b1b1215c391fb3cd0c9807f1f8b39989 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 05:09:19 -0400 Subject: [PATCH 02/23] Basic contrainer setup --- .github/workflows/devcontainer.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 6c0be8aeb1..38826cf688 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -1,4 +1,4 @@ -name: Test (neo-cli) +name: Build & Publish (devcontainer) on: push: @@ -19,13 +19,7 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and run Dev Container task + - name: Build & Publish (devcontainer) uses: devcontainers/ci@v0.3 with: - # Change this to point to your image name - imageName: ghcr.io/${{ github.repository_owner }}/neo:latest - # Change this to be your CI task/script - runCmd: | - # Add multiple commands to run if needed - apt-get update && apt-get install -y libleveldb-dev - dotnet test + imageName: ghcr.io/${{ github.repository_owner }}/neo From c23f15b7b1cf5f8cd823c3205b10d27b92dab61b Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 05:14:36 -0400 Subject: [PATCH 03/23] Updated version of `checkout` action job's step. --- .github/workflows/devcontainer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 38826cf688..7149ab7749 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -13,7 +13,7 @@ jobs: uses: actions/checkout@v4 - name: Login to GitHub Container Registry - uses: docker/login-action@v3 + uses: docker/login-action@v4 with: registry: ghcr.io username: ${{ github.repository_owner }} From 9f626609054ffbce218f7ba40a68ead5541cbfa8 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 05:48:01 -0400 Subject: [PATCH 04/23] Changed to `neo-cli` --- .github/workflows/devcontainer.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 7149ab7749..7c415e186d 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -2,7 +2,10 @@ name: Build & Publish (devcontainer) on: push: - branches: [master] + +env: + DOTNET_FRAMEWORK: net8.0 + NEO_INSTALL_PATH: /opt/neo-cli jobs: build: @@ -13,13 +16,24 @@ jobs: uses: actions/checkout@v4 - name: Login to GitHub Container Registry - uses: docker/login-action@v4 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build & Publish (devcontainer) + - name: Build and run Dev Container task uses: devcontainers/ci@v0.3 with: - imageName: ghcr.io/${{ github.repository_owner }}/neo + imageName: ghcr.io/${{ github.repository_owner }}/neo-cli + imageTag: dev + runCmd: | + sudo apt-get update + sudo apt-get install -y screen + dotnet publish ./src/Neo.CLI \ + --framework ${{ env.DOTNET_FRAMEWORK }} \ + --configuration Release \ + --output ${{ env.NEO_INSTALL_PATH }} \ + --verbosity normal \ + --version-suffix dev + screen -dmS neo ${{ env.NEO_INSTALL_PATH }}/neo-cli From 1b06cc1fb1c58314c600a1c88690d60b7445293f Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 05:55:10 -0400 Subject: [PATCH 05/23] Update `dockerfile` --- .devcontainer/devcontainer.dockerfile | 5 +++-- .github/workflows/devcontainer.yml | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.devcontainer/devcontainer.dockerfile b/.devcontainer/devcontainer.dockerfile index 3b16107e9e..fa117b8ee8 100644 --- a/.devcontainer/devcontainer.dockerfile +++ b/.devcontainer/devcontainer.dockerfile @@ -1,3 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy +FROM mcr.microsoft.com/devcontainers/dotnet:8.0-bullseye-slim # Install the libleveldb-dev package -RUN apt-get update && apt-get install -y libleveldb-dev +RUN apt-get update +RUN apt-get install -y libleveldb-dev screen diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 7c415e186d..61c1fe3625 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -28,8 +28,6 @@ jobs: imageName: ghcr.io/${{ github.repository_owner }}/neo-cli imageTag: dev runCmd: | - sudo apt-get update - sudo apt-get install -y screen dotnet publish ./src/Neo.CLI \ --framework ${{ env.DOTNET_FRAMEWORK }} \ --configuration Release \ From 058d16aae94953c47be3042709e30aaaded20fd6 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 05:57:13 -0400 Subject: [PATCH 06/23] Updated `PostCreateCommand` --- .devcontainer/devcontainer.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5e9bdf6374..f21a8a9af9 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,17 +1,17 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { - "name": "C# (.NET)", - "build": { - // Path is relative to the devcontainer.json file. - "dockerfile": "devcontainer.dockerfile" - }, - "postCreateCommand": "dotnet build", - "customizations": { - "vscode": { - "extensions": [ - "ms-dotnettools.csdevkit" - ] - } - } + "name": "C# (.NET)", + "build": { + // Path is relative to the devcontainer.json file. + "dockerfile": "devcontainer.dockerfile" + }, + "postCreateCommand": "dotnet workload update", + "customizations": { + "vscode": { + "extensions": [ + "ms-dotnettools.csdevkit" + ] + } + } } From 6be5733b79b29e0e94fa30d0549eeb69c7d99c8a Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 05:59:37 -0400 Subject: [PATCH 07/23] Changed to `bookworm-slim` --- .devcontainer/devcontainer.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.dockerfile b/.devcontainer/devcontainer.dockerfile index fa117b8ee8..3dad69af29 100644 --- a/.devcontainer/devcontainer.dockerfile +++ b/.devcontainer/devcontainer.dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/dotnet:8.0-bullseye-slim +FROM mcr.microsoft.com/devcontainers/dotnet:8.0-bookworm-slim # Install the libleveldb-dev package RUN apt-get update RUN apt-get install -y libleveldb-dev screen From 0ce7674350c2b6cb582ced5fd554cefec7123751 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 06:03:25 -0400 Subject: [PATCH 08/23] Reverted to `Jammy` --- .devcontainer/devcontainer.dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.dockerfile b/.devcontainer/devcontainer.dockerfile index 3dad69af29..6a1b3f8557 100644 --- a/.devcontainer/devcontainer.dockerfile +++ b/.devcontainer/devcontainer.dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/devcontainers/dotnet:8.0-bookworm-slim +FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy # Install the libleveldb-dev package RUN apt-get update -RUN apt-get install -y libleveldb-dev screen +RUN apt-get install -y libleveldb-dev From 41ad46e1c507a1a7dfbc651a091ee8575fb59602 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 06:06:42 -0400 Subject: [PATCH 09/23] Added `sudo` command for `PostCreateCommand` --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f21a8a9af9..6b0efc7559 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ // Path is relative to the devcontainer.json file. "dockerfile": "devcontainer.dockerfile" }, - "postCreateCommand": "dotnet workload update", + "postCreateCommand": "sudo dotnet workload update", "customizations": { "vscode": { "extensions": [ From 66e3b3465f2e3eba35a7adfc21a6e0fb67c62854 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 06:17:04 -0400 Subject: [PATCH 10/23] Added permissions --- .github/workflows/devcontainer.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 61c1fe3625..367a43fff3 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -28,6 +28,9 @@ jobs: imageName: ghcr.io/${{ github.repository_owner }}/neo-cli imageTag: dev runCmd: | + sudo mkdir -vp ${{ env.NEO_INSTALL_PATH }} + sudo chgrp users ${{ env.NEO_INSTALL_PATH }} + sudo chmod a+rwx ${{ env.NEO_INSTALL_PATH }} dotnet publish ./src/Neo.CLI \ --framework ${{ env.DOTNET_FRAMEWORK }} \ --configuration Release \ From 5707d39b2091813057c3bbadeda98a5a7b8603d4 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 06:20:53 -0400 Subject: [PATCH 11/23] Removed `screen` command --- .github/workflows/devcontainer.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 367a43fff3..bd29f41dd0 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -37,4 +37,3 @@ jobs: --output ${{ env.NEO_INSTALL_PATH }} \ --verbosity normal \ --version-suffix dev - screen -dmS neo ${{ env.NEO_INSTALL_PATH }}/neo-cli From 299973bac6b7d0ed82e002567827eef4781a308c Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 06:27:06 -0400 Subject: [PATCH 12/23] Added to `bin` and `PostCreateCommand` --- .github/workflows/devcontainer.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index bd29f41dd0..908f07083c 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -37,3 +37,5 @@ jobs: --output ${{ env.NEO_INSTALL_PATH }} \ --verbosity normal \ --version-suffix dev + sudo ln -s ${{ env.NEO_INSTALL_PATH }}/neo-cli /usr/bin/neo-cli + sudo chmod a+rwx /usr/bin/neo-cli From 5e54cf168b71a114c59033e3d8aad5a8c255f88d Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 06:34:57 -0400 Subject: [PATCH 13/23] Changed `devcontainer` files --- .devcontainer/devcontainer.dockerfile | 1 + .devcontainer/devcontainer.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.dockerfile b/.devcontainer/devcontainer.dockerfile index 6a1b3f8557..3135e9095a 100644 --- a/.devcontainer/devcontainer.dockerfile +++ b/.devcontainer/devcontainer.dockerfile @@ -2,3 +2,4 @@ FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy # Install the libleveldb-dev package RUN apt-get update RUN apt-get install -y libleveldb-dev +RUN dotnet workload update diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 6b0efc7559..51e954e2ae 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -6,7 +6,7 @@ // Path is relative to the devcontainer.json file. "dockerfile": "devcontainer.dockerfile" }, - "postCreateCommand": "sudo dotnet workload update", + //"postCreateCommand": "", "customizations": { "vscode": { "extensions": [ From 3ec9f3b5e63770d4f3a45604a3cbe02c17222ed7 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 06:56:33 -0400 Subject: [PATCH 14/23] Reverted builds --- .github/workflows/devcontainer.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 908f07083c..b95c69bedd 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -3,10 +3,6 @@ name: Build & Publish (devcontainer) on: push: -env: - DOTNET_FRAMEWORK: net8.0 - NEO_INSTALL_PATH: /opt/neo-cli - jobs: build: runs-on: ubuntu-latest @@ -25,17 +21,5 @@ jobs: - name: Build and run Dev Container task uses: devcontainers/ci@v0.3 with: - imageName: ghcr.io/${{ github.repository_owner }}/neo-cli - imageTag: dev - runCmd: | - sudo mkdir -vp ${{ env.NEO_INSTALL_PATH }} - sudo chgrp users ${{ env.NEO_INSTALL_PATH }} - sudo chmod a+rwx ${{ env.NEO_INSTALL_PATH }} - dotnet publish ./src/Neo.CLI \ - --framework ${{ env.DOTNET_FRAMEWORK }} \ - --configuration Release \ - --output ${{ env.NEO_INSTALL_PATH }} \ - --verbosity normal \ - --version-suffix dev - sudo ln -s ${{ env.NEO_INSTALL_PATH }}/neo-cli /usr/bin/neo-cli - sudo chmod a+rwx /usr/bin/neo-cli + imageName: ghcr.io/${{ github.repository_owner }}/neo + push: always From 02f6229d705564a9b2e1bbe3f0330c439a55418f Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 15:37:12 -0400 Subject: [PATCH 15/23] Added `neo` repo to devcontainer --- .devcontainer/devcontainer.dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.devcontainer/devcontainer.dockerfile b/.devcontainer/devcontainer.dockerfile index 3135e9095a..6d43e7558c 100644 --- a/.devcontainer/devcontainer.dockerfile +++ b/.devcontainer/devcontainer.dockerfile @@ -3,3 +3,5 @@ FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy RUN apt-get update RUN apt-get install -y libleveldb-dev RUN dotnet workload update + +COPY * /neo/source \ No newline at end of file From 85cf83ec3c47de0ccee3789b4744023a5f69ca4e Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 17:55:26 -0400 Subject: [PATCH 16/23] Changed to docker-image for github registry --- .devcontainer/devcontainer.dockerfile | 2 - .github/workflows/devcontainer.yml | 25 -------- .github/workflows/docker.yml | 81 ++++++++++++++++++++++++ .neo/builds/neo-cli-docker/Dockerfile | 8 +++ .neo/builds/neo-cli-docker/dist/.gitkeep | 0 5 files changed, 89 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/devcontainer.yml create mode 100644 .github/workflows/docker.yml create mode 100644 .neo/builds/neo-cli-docker/Dockerfile create mode 100644 .neo/builds/neo-cli-docker/dist/.gitkeep diff --git a/.devcontainer/devcontainer.dockerfile b/.devcontainer/devcontainer.dockerfile index 6d43e7558c..3135e9095a 100644 --- a/.devcontainer/devcontainer.dockerfile +++ b/.devcontainer/devcontainer.dockerfile @@ -3,5 +3,3 @@ FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy RUN apt-get update RUN apt-get install -y libleveldb-dev RUN dotnet workload update - -COPY * /neo/source \ No newline at end of file diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml deleted file mode 100644 index b95c69bedd..0000000000 --- a/.github/workflows/devcontainer.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build & Publish (devcontainer) - -on: - push: - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout (GitHub) - uses: actions/checkout@v4 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and run Dev Container task - uses: devcontainers/ci@v0.3 - with: - imageName: ghcr.io/${{ github.repository_owner }}/neo - push: always diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000000..028334268b --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,81 @@ +name: Publish (docker-image) + +on: + release: + types: [published] + +env: + DIST_DIR: .neo/builds/neo-cli-docker + +jobs: + neo-cli-build: + runs-on: ubuntu-latest + + steps: + - name: Set Application Version (Environment Variable) + run: | + APP_VERSION=$(echo '${{ github.event.release.tag_name }}' | cut -d 'v' -f 2) + echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV + + - name: Checkout (GitHub) + uses: actions/checkout@v4 + + - name: Build (neo-cli) + run: | + dotnet publish ./src/Neo.CLI \ + --version-suffix linux-x64 \ + --framework net8.0 \ + --configuration Release \ + --runtime linux-x64 \ + --self-contained true \ + --output ${{ env.DIST_DIR }}/dist \ + --verbosity normal \ + -p:VersionPrefix=${{ env.APP_VERSION }} \ + -p:RuntimeIdentifier=linux-x64 \ + -p:SelfContained=true \ + -p:IncludeNativeLibrariesForSelfExtract=false \ + -p:PublishTrimmed=false \ + -p:PublishSingleFile=true \ + -p:PublishReadyToRun=true \ + -p:EnableCompressionInSingleFile=true \ + -p:DebugType=embedded \ + -p:ServerGarbageCollection=true + + - name: Build (LevelDbStore) + run: | + dotnet build ./src/Plugins/LevelDBStore \ + --version-suffix linux-x64 \ + --framework net8.0 \ + --configuration Release \ + --output ${{ env.DIST_DIR }}/dist/Plugins/LevelDBStore \ + --verbosity normal \ + -p:VersionPrefix=${{ env.APP_VERSION }} + + - name: Remove (junk) + run: | + rm -v ${{ env.DIST_DIR }}/dist/Plugins/LevelDBStore/Neo* + rm -v ${{ env.DIST_DIR }}/dist/Plugins/LevelDBStore/*.pdb + rm -v ${{ env.DIST_DIR }}/dist/Plugins/LevelDBStore/*.xml + rm -v ${{ env.DIST_DIR }}/dist/*.xml + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and Push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64 + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/neo-cli:latest + ghcr.io/${{ github.repository_owner }}/neo-cli:${{ env.APP_VERSION }} diff --git a/.neo/builds/neo-cli-docker/Dockerfile b/.neo/builds/neo-cli-docker/Dockerfile new file mode 100644 index 0000000000..2ccfa66e34 --- /dev/null +++ b/.neo/builds/neo-cli-docker/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:jammy + +# Install the apt-get packages +RUN apt-get update +RUN apt-get install -y libicu-dev libleveldb-dev screen + +COPY ./dist /opt/neo-cli +RUN ln -s /opt/neo-cli/neo-cli /usr/bin diff --git a/.neo/builds/neo-cli-docker/dist/.gitkeep b/.neo/builds/neo-cli-docker/dist/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 From 34cb95f2ce3051df8e18bc4700fa504dd23f64bc Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 20:50:58 -0400 Subject: [PATCH 17/23] Fixed Bugs in `docker` support for `neo-cli` image --- .github/workflows/docker.yml | 54 +++++++++---------- .github/workflows/pkgs-delete.yml | 13 ++++- .neo/builds/neo-cli-docker/dist/.gitkeep | 0 .../neo-cli}/Dockerfile | 2 +- 4 files changed, 38 insertions(+), 31 deletions(-) delete mode 100644 .neo/builds/neo-cli-docker/dist/.gitkeep rename .neo/{builds/neo-cli-docker => docker/neo-cli}/Dockerfile (87%) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 028334268b..3d8e7d0d6c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -5,7 +5,8 @@ on: types: [published] env: - DIST_DIR: .neo/builds/neo-cli-docker + DOTNET_VERSION: 8.0.x + DIST_DIR: ./dist jobs: neo-cli-build: @@ -20,15 +21,19 @@ jobs: - name: Checkout (GitHub) uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + - name: Build (neo-cli) run: | dotnet publish ./src/Neo.CLI \ - --version-suffix linux-x64 \ --framework net8.0 \ --configuration Release \ --runtime linux-x64 \ --self-contained true \ - --output ${{ env.DIST_DIR }}/dist \ + --output ${{ env.DIST_DIR }} \ --verbosity normal \ -p:VersionPrefix=${{ env.APP_VERSION }} \ -p:RuntimeIdentifier=linux-x64 \ @@ -44,38 +49,29 @@ jobs: - name: Build (LevelDbStore) run: | dotnet build ./src/Plugins/LevelDBStore \ - --version-suffix linux-x64 \ --framework net8.0 \ --configuration Release \ - --output ${{ env.DIST_DIR }}/dist/Plugins/LevelDBStore \ + --output ${{ env.DIST_DIR }}/Plugins/LevelDBStore \ --verbosity normal \ -p:VersionPrefix=${{ env.APP_VERSION }} - name: Remove (junk) run: | - rm -v ${{ env.DIST_DIR }}/dist/Plugins/LevelDBStore/Neo* - rm -v ${{ env.DIST_DIR }}/dist/Plugins/LevelDBStore/*.pdb - rm -v ${{ env.DIST_DIR }}/dist/Plugins/LevelDBStore/*.xml - rm -v ${{ env.DIST_DIR }}/dist/*.xml - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + rm -v ${{ env.DIST_DIR }}/Plugins/LevelDBStore/Neo* + rm -v ${{ env.DIST_DIR }}/Plugins/LevelDBStore/*.pdb + rm -v ${{ env.DIST_DIR }}/Plugins/LevelDBStore/*.xml + rm -v ${{ env.DIST_DIR }}/*.xml - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker Login + run: | + docker login ghcr.io \ + --username ${{ github.repository_owner }} \ + --password ${{ secrets.GITHUB_TOKEN }} - - name: Build and Push - uses: docker/build-push-action@v6 - with: - platforms: linux/amd64 - push: true - tags: | - ghcr.io/${{ github.repository_owner }}/neo-cli:latest - ghcr.io/${{ github.repository_owner }}/neo-cli:${{ env.APP_VERSION }} + - name: Docker Build + run: | + docker build . \ + --file ./.neo/docker/neo-cli/Dockerfile \ + --tag ghcr.io/${{ github.repository_owner }}/neo-cli:latest \ + --tag ghcr.io/${{ github.repository_owner }}/neo-cli:${{ env.APP_VERSION }} \ + --push diff --git a/.github/workflows/pkgs-delete.yml b/.github/workflows/pkgs-delete.yml index cf3471b551..2dc580953d 100644 --- a/.github/workflows/pkgs-delete.yml +++ b/.github/workflows/pkgs-delete.yml @@ -102,7 +102,7 @@ jobs: delete-only-pre-release-versions: "true" token: "${{ secrets.GITHUB_TOKEN }}" - - name: Delete Neo Package + - name: Delete Neo Package (nuget) uses: actions/delete-package-versions@v4 with: package-name: Neo @@ -110,6 +110,16 @@ jobs: min-versions-to-keep: 3 delete-only-pre-release-versions: "true" token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Delete Neo Package (docker) + uses: actions/delete-package-versions@v4 + with: + package-name: Neo + package-type: docker + min-versions-to-keep: 1 + delete-only-pre-release-versions: "true" + token: "${{ secrets.GITHUB_TOKEN }}" + - name: Delete Neo.ConsoleService Package uses: actions/delete-package-versions@v4 with: @@ -118,6 +128,7 @@ jobs: min-versions-to-keep: 3 delete-only-pre-release-versions: "true" token: "${{ secrets.GITHUB_TOKEN }}" + - name: Delete Neo.Extensions Package uses: actions/delete-package-versions@v4 with: diff --git a/.neo/builds/neo-cli-docker/dist/.gitkeep b/.neo/builds/neo-cli-docker/dist/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/.neo/builds/neo-cli-docker/Dockerfile b/.neo/docker/neo-cli/Dockerfile similarity index 87% rename from .neo/builds/neo-cli-docker/Dockerfile rename to .neo/docker/neo-cli/Dockerfile index 2ccfa66e34..afdd97e597 100644 --- a/.neo/builds/neo-cli-docker/Dockerfile +++ b/.neo/docker/neo-cli/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:jammy +FROM debian:stable-slim # Install the apt-get packages RUN apt-get update From a07c61937426a7b835da358e6a7085a9a14b1b1d Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 21:00:17 -0400 Subject: [PATCH 18/23] Added type `container` --- .github/workflows/pkgs-delete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkgs-delete.yml b/.github/workflows/pkgs-delete.yml index 2dc580953d..4be6e5a3e5 100644 --- a/.github/workflows/pkgs-delete.yml +++ b/.github/workflows/pkgs-delete.yml @@ -115,7 +115,7 @@ jobs: uses: actions/delete-package-versions@v4 with: package-name: Neo - package-type: docker + package-type: container min-versions-to-keep: 1 delete-only-pre-release-versions: "true" token: "${{ secrets.GITHUB_TOKEN }}" From e3fbfbd0c1e5ad555686849e95dc28d21d015840 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 21:04:39 -0400 Subject: [PATCH 19/23] Revert `.devcontainer` folder --- .devcontainer/devcontainer.dockerfile | 6 ++---- .devcontainer/devcontainer.json | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/.devcontainer/devcontainer.dockerfile b/.devcontainer/devcontainer.dockerfile index 3135e9095a..b50b45c181 100644 --- a/.devcontainer/devcontainer.dockerfile +++ b/.devcontainer/devcontainer.dockerfile @@ -1,5 +1,3 @@ FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy -# Install the libleveldb-dev package -RUN apt-get update -RUN apt-get install -y libleveldb-dev -RUN dotnet workload update +# Install the libleveldb-dev package +RUN apt-get update && apt-get install -y libleveldb-dev diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 51e954e2ae..5e9bdf6374 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,17 +1,17 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/dotnet { - "name": "C# (.NET)", - "build": { - // Path is relative to the devcontainer.json file. - "dockerfile": "devcontainer.dockerfile" - }, - //"postCreateCommand": "", - "customizations": { - "vscode": { - "extensions": [ - "ms-dotnettools.csdevkit" - ] - } - } + "name": "C# (.NET)", + "build": { + // Path is relative to the devcontainer.json file. + "dockerfile": "devcontainer.dockerfile" + }, + "postCreateCommand": "dotnet build", + "customizations": { + "vscode": { + "extensions": [ + "ms-dotnettools.csdevkit" + ] + } + } } From 48ddb3ca93ba4986c0879f1b6067fa2b946ad51d Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Mon, 24 Jun 2024 21:05:16 -0400 Subject: [PATCH 20/23] format --- .devcontainer/devcontainer.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.dockerfile b/.devcontainer/devcontainer.dockerfile index b50b45c181..3b16107e9e 100644 --- a/.devcontainer/devcontainer.dockerfile +++ b/.devcontainer/devcontainer.dockerfile @@ -1,3 +1,3 @@ FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy -# Install the libleveldb-dev package +# Install the libleveldb-dev package RUN apt-get update && apt-get install -y libleveldb-dev From 57233d2abd57f0a819622454cb3e4d1415cf6573 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Tue, 25 Jun 2024 13:33:38 -0400 Subject: [PATCH 21/23] Changed workflow to `docker` for `pkgs-delete.yml` since we use `v4` --- .github/workflows/pkgs-delete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pkgs-delete.yml b/.github/workflows/pkgs-delete.yml index 4be6e5a3e5..2dc580953d 100644 --- a/.github/workflows/pkgs-delete.yml +++ b/.github/workflows/pkgs-delete.yml @@ -115,7 +115,7 @@ jobs: uses: actions/delete-package-versions@v4 with: package-name: Neo - package-type: container + package-type: docker min-versions-to-keep: 1 delete-only-pre-release-versions: "true" token: "${{ secrets.GITHUB_TOKEN }}" From b877de06629dbad8b42726ff42113a991d5eb4b2 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Tue, 25 Jun 2024 13:45:32 -0400 Subject: [PATCH 22/23] Deleted `Dockerfile` from `src\Neo.CLI` --- src/Neo.CLI/Dockerfile | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 src/Neo.CLI/Dockerfile diff --git a/src/Neo.CLI/Dockerfile b/src/Neo.CLI/Dockerfile deleted file mode 100644 index 5863e9a74d..0000000000 --- a/src/Neo.CLI/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS Build - -# Run this from the repository root folder -COPY src . -COPY NuGet.Config /Neo.CLI - -WORKDIR /Neo.CLI -RUN dotnet restore && dotnet publish -f net8.0 -c Release -o /app - -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0 AS Final -RUN apt-get update && apt-get install -y \ - screen \ - libleveldb-dev \ - sqlite3 -RUN rm -rf /var/lib/apt/lists/* - -WORKDIR /Neo.CLI -COPY --from=Build /app . - -ENTRYPOINT ["screen","-DmS","node","dotnet","neo-cli.dll","-r"] From b7c941c7051ba06622cbae77b9cb8a799229b100 Mon Sep 17 00:00:00 2001 From: Christopher Schuchardt Date: Wed, 26 Jun 2024 07:58:27 -0400 Subject: [PATCH 23/23] Revert "Deleted `Dockerfile` from `src\Neo.CLI`" This reverts commit b877de06629dbad8b42726ff42113a991d5eb4b2. --- src/Neo.CLI/Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/Neo.CLI/Dockerfile diff --git a/src/Neo.CLI/Dockerfile b/src/Neo.CLI/Dockerfile new file mode 100644 index 0000000000..5863e9a74d --- /dev/null +++ b/src/Neo.CLI/Dockerfile @@ -0,0 +1,20 @@ +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS Build + +# Run this from the repository root folder +COPY src . +COPY NuGet.Config /Neo.CLI + +WORKDIR /Neo.CLI +RUN dotnet restore && dotnet publish -f net8.0 -c Release -o /app + +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0 AS Final +RUN apt-get update && apt-get install -y \ + screen \ + libleveldb-dev \ + sqlite3 +RUN rm -rf /var/lib/apt/lists/* + +WORKDIR /Neo.CLI +COPY --from=Build /app . + +ENTRYPOINT ["screen","-DmS","node","dotnet","neo-cli.dll","-r"]