From 165f52715a8966e6fc921f97b71569c3e7869e0d Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 12:11:06 +0800 Subject: [PATCH 01/10] Update build configurations and workflow Changed the GitHub Actions workflow trigger from push to workflow_dispatch and updated the GraalVM version from 21.0.2 to 23.0.1 for the build process. --- .github/workflows/dev-release-cli.yml | 11 +++++++---- .../native-image/yaci-cli/native-image.properties | 2 +- .../native-image/yaci-cli/native-image.properties.ci | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev-release-cli.yml b/.github/workflows/dev-release-cli.yml index 2147b78c..3e3f9a7c 100644 --- a/.github/workflows/dev-release-cli.yml +++ b/.github/workflows/dev-release-cli.yml @@ -1,9 +1,12 @@ name: Build and Release Yaci CLI Zip +#on: +# push: +# tags: +# - 'rel-dev-*' + on: - push: - tags: - - 'rel-dev-*' + workflow_dispatch: jobs: buildAndPush: @@ -22,7 +25,7 @@ jobs: java-version: '21' distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - version: '21.0.2' + version: '23.0.1' native-image-job-reports: 'true' - name: Get Tag from version file run: | diff --git a/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties b/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties index 48e6ecce..586ca44b 100644 --- a/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties +++ b/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties @@ -1,4 +1,4 @@ -Args = -H:+StaticExecutableWithDynamicLibC --initialize-at-run-time=io.netty.channel.epoll.Epoll \ +Args = --static-nolibc -march=compatibility --initialize-at-run-time=io.netty.channel.epoll.Epoll \ --initialize-at-run-time=io.netty.channel.epoll.Native \ --initialize-at-run-time=io.netty.channel.epoll.EpollEventLoop \ --initialize-at-run-time=io.netty.channel.epoll.EpollEventArray \ diff --git a/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties.ci b/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties.ci index d0da1323..46c401d8 100644 --- a/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties.ci +++ b/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties.ci @@ -1,4 +1,4 @@ -Args = --static --libc=musl --initialize-at-run-time=io.netty.channel.epoll.Epoll \ +Args = --static --libc=musl -march=compatibility --initialize-at-run-time=io.netty.channel.epoll.Epoll \ --initialize-at-run-time=io.netty.channel.epoll.Native \ --initialize-at-run-time=io.netty.channel.epoll.EpollEventLoop \ --initialize-at-run-time=io.netty.channel.epoll.EpollEventArray \ From c1d5dee83f9df4ee10641994ad7acddc676bc4f2 Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 12:12:52 +0800 Subject: [PATCH 02/10] Update build configurations and workflow Changed the GitHub Actions workflow trigger from push to workflow_dispatch and updated the GraalVM version from 21.0.2 to 23.0.1 for the build process. --- .github/workflows/dev-release-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-release-cli.yml b/.github/workflows/dev-release-cli.yml index 3e3f9a7c..d40875b6 100644 --- a/.github/workflows/dev-release-cli.yml +++ b/.github/workflows/dev-release-cli.yml @@ -1,4 +1,4 @@ -name: Build and Release Yaci CLI Zip +name: Dev Build and Upload Yaci CLI Zip #on: # push: From 9bb0273e4eb9fa5e27d2097109c217acf67897ef Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 12:32:36 +0800 Subject: [PATCH 03/10] Update GraalVM versions in workflows --- .github/workflows/dev-release-cli.yml | 2 +- .github/workflows/release-cli.yml | 2 +- .../META-INF/native-image/yaci-cli/native-image.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-release-cli.yml b/.github/workflows/dev-release-cli.yml index d40875b6..153a4a44 100644 --- a/.github/workflows/dev-release-cli.yml +++ b/.github/workflows/dev-release-cli.yml @@ -25,7 +25,7 @@ jobs: java-version: '21' distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - version: '23.0.1' + version: '21.0.5' native-image-job-reports: 'true' - name: Get Tag from version file run: | diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 041834c1..d0107ad4 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -22,7 +22,7 @@ jobs: java-version: '21' distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} - version: '21.0.2' + version: '21.0.5' native-image-job-reports: 'true' - name: Get Tag from version file run: | diff --git a/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties b/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties index 586ca44b..9994ee87 100644 --- a/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties +++ b/applications/cli/src/main/resources/META-INF/native-image/yaci-cli/native-image.properties @@ -1,4 +1,4 @@ -Args = --static-nolibc -march=compatibility --initialize-at-run-time=io.netty.channel.epoll.Epoll \ +Args = -H:+StaticExecutableWithDynamicLibC -march=compatibility --initialize-at-run-time=io.netty.channel.epoll.Epoll \ --initialize-at-run-time=io.netty.channel.epoll.Native \ --initialize-at-run-time=io.netty.channel.epoll.EpollEventLoop \ --initialize-at-run-time=io.netty.channel.epoll.EpollEventArray \ From d99c529b4654da56130e087edad9c694b1ffd715 Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 12:55:47 +0800 Subject: [PATCH 04/10] Enable Windows runner support in GitHub Actions workflow --- .github/workflows/dev-release-cli.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-release-cli.yml b/.github/workflows/dev-release-cli.yml index 153a4a44..b5f76199 100644 --- a/.github/workflows/dev-release-cli.yml +++ b/.github/workflows/dev-release-cli.yml @@ -12,7 +12,8 @@ jobs: buildAndPush: strategy: matrix: - os: ["ubuntu-20.04", "macos-14"] +# os: ["ubuntu-20.04", "macos-14", "windows-latest"] + os: ["ubuntu-20.04", "macos-14", "windows-latest"] runs-on: ${{ matrix.os }} env: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} @@ -28,9 +29,16 @@ jobs: version: '21.0.5' native-image-job-reports: 'true' - name: Get Tag from version file + if: runner.os != 'Windows' run: | TAG=$(grep "tag=" config/version | cut -d'=' -f2) echo "TAG=${TAG}" >> $GITHUB_ENV + - name: Get Tag from (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + TAG = (Get-Content config/version | Where-Object { $_ -match "^tag=" } | ForEach-Object { $_.Split('=')[1].Trim() }) + echo "TAG=${TAG}" >> $GITHUB_ENV - name: Grant execute permission for gradlew working-directory: applications/cli run: chmod +x gradlew @@ -43,8 +51,19 @@ jobs: if: runner.os == 'macOS' run: | echo "os_prefix=macos" >> $GITHUB_ENV - - name: Set lowercase architecture + - name: Windows specific env + if: runner.os == 'Windows' + run: | + echo "os_prefix=windows" >> $GITHUB_ENV + - name: Set lowercase architecture (Linux/Mac) + if: runner.os != 'Windows' run: echo "arch=$(echo ${{ runner.arch }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Set lowercase architecture (Windows) + if: runner.os == 'Windows' + shell: pwsh + run: | + $arch = "${{ runner.arch }}".ToLower() + Add-Content -Path $env:GITHUB_ENV -Value "arch=$arch" - name: Build with Gradle working-directory: applications/cli run: ./gradlew --no-daemon -i -Pversion=${{ env.TAG }} clean build nativeCompile cliZip From a8395bd5156b884fb1458392f76414b82e2369f4 Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 13:09:24 +0800 Subject: [PATCH 05/10] Enable Windows runner support in GitHub Actions workflow --- .github/workflows/dev-release-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-release-cli.yml b/.github/workflows/dev-release-cli.yml index b5f76199..18e1b096 100644 --- a/.github/workflows/dev-release-cli.yml +++ b/.github/workflows/dev-release-cli.yml @@ -37,7 +37,7 @@ jobs: if: runner.os == 'Windows' shell: pwsh run: | - TAG = (Get-Content config/version | Where-Object { $_ -match "^tag=" } | ForEach-Object { $_.Split('=')[1].Trim() }) + $TAG = (Get-Content config/version | Where-Object { $_ -match "^tag=" } | ForEach-Object { $_.Split('=')[1].Trim() }) echo "TAG=${TAG}" >> $GITHUB_ENV - name: Grant execute permission for gradlew working-directory: applications/cli From 30979cac5b00e26a0fc4f7bdfa05addcc1bedb48 Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 13:20:15 +0800 Subject: [PATCH 06/10] Enable Windows runner support in GitHub Actions workflow --- .github/workflows/dev-release-cli.yml | 56 +++++++++++++++++++-------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dev-release-cli.yml b/.github/workflows/dev-release-cli.yml index 18e1b096..8a9751a8 100644 --- a/.github/workflows/dev-release-cli.yml +++ b/.github/workflows/dev-release-cli.yml @@ -12,8 +12,7 @@ jobs: buildAndPush: strategy: matrix: -# os: ["ubuntu-20.04", "macos-14", "windows-latest"] - os: ["ubuntu-20.04", "macos-14", "windows-latest"] + os: ["ubuntu-20.04", "macos-14"] runs-on: ${{ matrix.os }} env: DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} @@ -29,16 +28,9 @@ jobs: version: '21.0.5' native-image-job-reports: 'true' - name: Get Tag from version file - if: runner.os != 'Windows' run: | TAG=$(grep "tag=" config/version | cut -d'=' -f2) echo "TAG=${TAG}" >> $GITHUB_ENV - - name: Get Tag from (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - $TAG = (Get-Content config/version | Where-Object { $_ -match "^tag=" } | ForEach-Object { $_.Split('=')[1].Trim() }) - echo "TAG=${TAG}" >> $GITHUB_ENV - name: Grant execute permission for gradlew working-directory: applications/cli run: chmod +x gradlew @@ -51,24 +43,56 @@ jobs: if: runner.os == 'macOS' run: | echo "os_prefix=macos" >> $GITHUB_ENV - - name: Windows specific env + - name: Set lowercase architecture + run: echo "arch=$(echo ${{ runner.arch }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV + - name: Build with Gradle + working-directory: applications/cli + run: ./gradlew --no-daemon -i -Pversion=${{ env.TAG }} clean build nativeCompile cliZip + - name: Copy artifacts + working-directory: applications/cli + run: mv build/yaci-cli-${{ env.TAG }}.zip build/yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }}.zip + - uses: actions/upload-artifact@v4 + with: + name: yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }} + path: ./applications/cli/build/yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }}.zip + + windowsBuild: + strategy: + matrix: + os: ["windows-latest"] + runs-on: ${{ matrix.os }} + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + FORCE_COLOR: 1 + steps: + - uses: actions/checkout@v4 + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '21' + distribution: 'graalvm' + github-token: ${{ secrets.GITHUB_TOKEN }} + version: '21.0.5' + native-image-job-reports: 'true' + - name: Get Tag from (Windows) if: runner.os == 'Windows' + shell: pwsh + run: | + $TAG = (Get-Content config/version | Where-Object { $_ -match "^tag=" } | ForEach-Object { $_.Split('=')[1].Trim() }) + echo "TAG=${TAG}" >> $GITHUB_ENV + - name: Windows specific env run: | echo "os_prefix=windows" >> $GITHUB_ENV - - name: Set lowercase architecture (Linux/Mac) - if: runner.os != 'Windows' - run: echo "arch=$(echo ${{ runner.arch }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - name: Set lowercase architecture (Windows) - if: runner.os == 'Windows' shell: pwsh run: | $arch = "${{ runner.arch }}".ToLower() Add-Content -Path $env:GITHUB_ENV -Value "arch=$arch" - name: Build with Gradle - working-directory: applications/cli + working-directory: applications\cli run: ./gradlew --no-daemon -i -Pversion=${{ env.TAG }} clean build nativeCompile cliZip - name: Copy artifacts - working-directory: applications/cli + working-directory: applications\cli run: mv build/yaci-cli-${{ env.TAG }}.zip build/yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }}.zip - uses: actions/upload-artifact@v4 with: From 925b1a616cc966bd77de5547292ce90bce2dfd5b Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 13:26:48 +0800 Subject: [PATCH 07/10] Enable Windows runner support in GitHub Actions workflow --- .github/workflows/dev-release-cli.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dev-release-cli.yml b/.github/workflows/dev-release-cli.yml index 8a9751a8..beb68b0c 100644 --- a/.github/workflows/dev-release-cli.yml +++ b/.github/workflows/dev-release-cli.yml @@ -79,10 +79,10 @@ jobs: shell: pwsh run: | $TAG = (Get-Content config/version | Where-Object { $_ -match "^tag=" } | ForEach-Object { $_.Split('=')[1].Trim() }) - echo "TAG=${TAG}" >> $GITHUB_ENV + Add-Content -Path $env:GITHUB_ENV -Value "TAG=$TAG" - name: Windows specific env run: | - echo "os_prefix=windows" >> $GITHUB_ENV + Add-Content -Path $env:GITHUB_ENV -Value "os_prefix=windows" - name: Set lowercase architecture (Windows) shell: pwsh run: | From b76adb73543b1beb344d0f6ad62049875b141080 Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 13:40:39 +0800 Subject: [PATCH 08/10] Fix Gradle command quotation for version tag --- .github/workflows/dev-release-cli.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dev-release-cli.yml b/.github/workflows/dev-release-cli.yml index beb68b0c..386c3bb8 100644 --- a/.github/workflows/dev-release-cli.yml +++ b/.github/workflows/dev-release-cli.yml @@ -90,7 +90,7 @@ jobs: Add-Content -Path $env:GITHUB_ENV -Value "arch=$arch" - name: Build with Gradle working-directory: applications\cli - run: ./gradlew --no-daemon -i -Pversion=${{ env.TAG }} clean build nativeCompile cliZip + run: ./gradlew --no-daemon -i -Pversion="${{ env.TAG }}" clean build nativeCompile cliZip - name: Copy artifacts working-directory: applications\cli run: mv build/yaci-cli-${{ env.TAG }}.zip build/yaci-cli-${{ env.TAG }}-${{ env.os_prefix }}-${{ env.arch }}.zip From 84e67e384142f8e8eb8a9997e1607ffddc9a61e3 Mon Sep 17 00:00:00 2001 From: Satya Date: Tue, 19 Nov 2024 18:56:01 +0800 Subject: [PATCH 09/10] Enable Windows support for local cluster services --- .../yacicli/localcluster/ClusterService.java | 15 +++++++++++++-- .../yacicli/localcluster/ClusterStartService.java | 11 +++++++++-- .../localcluster/templates/devnet/node/node.bat | 15 +++++++++++++++ .../localcluster/templates/devnet/submit-api.bat | 9 +++++++++ 4 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 applications/cli/src/main/resources/localcluster/templates/devnet/node/node.bat create mode 100644 applications/cli/src/main/resources/localcluster/templates/devnet/submit-api.bat diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ClusterService.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ClusterService.java index 262d844b..a4c8439c 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ClusterService.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ClusterService.java @@ -385,8 +385,14 @@ private void updateSubmitApiFiles(Path destPath, long protocolMagic, int submitA values.put("SUBMIT_API_PORT", String.valueOf(submitApiPort)); values.put("PROTOCOL_MAGIC", String.valueOf(protocolMagic)); + Path submitApiSh; //Update submit api script - Path submitApiSh = destPath.resolve("submit-api.sh"); + if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) { + submitApiSh = destPath.resolve("submit-api.bat"); + } else { + submitApiSh = destPath.resolve("submit-api.sh"); + } + try { templateEngine.replaceValues(submitApiSh, values); } catch (Exception e) { @@ -441,7 +447,12 @@ public void saveClusterInfo(Path clusterFolder, ClusterInfo clusterInfo) throws throw new IllegalStateException("Cluster folder not found - " + clusterFolder); } - String socketPath = clusterFolder.resolve(NODE_FOLDER_PREFIX).resolve("node.sock").toString(); + String socketPath; + if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) { + socketPath = "\\\\.\\pipe\\node.sock"; + } else { + socketPath = clusterFolder.resolve(NODE_FOLDER_PREFIX).resolve("node.sock").toString(); + } clusterInfo.setSocketPath(socketPath); String clusterInfoPath = clusterFolder.resolve(ClusterConfig.CLUSTER_INFO_FILE).toAbsolutePath().toString(); diff --git a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ClusterStartService.java b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ClusterStartService.java index 98a542ea..5cb2ba51 100644 --- a/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ClusterStartService.java +++ b/applications/cli/src/main/java/com/bloxbean/cardano/yacicli/localcluster/ClusterStartService.java @@ -191,7 +191,7 @@ private Process startNode(Path clusterFolder, ClusterInfo clusterInfo, Consumer< ProcessBuilder builder = new ProcessBuilder(); if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) { - builder.command("cmd.exe", startScript + ".bat"); + builder.command("cmd", "/c", startScript + ".bat"); } else { builder.command("sh", startScript + ".sh"); } @@ -220,6 +220,9 @@ private Process startSubmitApi(ClusterInfo clusterInfo, Path clusterFolder, Cons //Check if cardano-submit-api exists String cardanoSubmitCli = "cardano-submit-api"; + if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) + cardanoSubmitCli = "cardano-submit-api.exe"; + Path binFolder = Path.of(clusterConfig.getCLIBinFolder()); Path cardanoSubmitCliPath = binFolder.resolve(cardanoSubmitCli); if (!Files.exists(cardanoSubmitCliPath)) { @@ -229,7 +232,11 @@ private Process startSubmitApi(ClusterInfo clusterInfo, Path clusterFolder, Cons } ProcessBuilder builder = new ProcessBuilder(); - builder.command("sh", "submit-api.sh"); + if (OSUtil.getOperatingSystem() == OSUtil.OS.WINDOWS) { + builder.command("cmd", "/c", "submit-api.bat"); + } else { + builder.command("sh", "submit-api.sh"); + } File submitApiStartDir = new File(clusterFolderPath); builder.directory(submitApiStartDir); diff --git a/applications/cli/src/main/resources/localcluster/templates/devnet/node/node.bat b/applications/cli/src/main/resources/localcluster/templates/devnet/node/node.bat new file mode 100644 index 00000000..4becd961 --- /dev/null +++ b/applications/cli/src/main/resources/localcluster/templates/devnet/node/node.bat @@ -0,0 +1,15 @@ +@echo off +setlocal enabledelayedexpansion + +"${BIN_FOLDER}\cardano-node.exe" run ^ + --config configuration.yaml ^ + --topology topology.json ^ + --database-path "db" ^ + --socket-path "\\.\pipe\node.sock" ^ + --shelley-kes-key .\pool-keys\kes.skey ^ + --shelley-vrf-key .\pool-keys\vrf.skey ^ + --byron-delegation-certificate .\pool-keys\byron-delegation.cert ^ + --byron-signing-key .\pool-keys\byron-delegate.key ^ + --shelley-operational-certificate .\pool-keys\opcert.cert ^ + --port ${port} >> node.log 2>&1 + diff --git a/applications/cli/src/main/resources/localcluster/templates/devnet/submit-api.bat b/applications/cli/src/main/resources/localcluster/templates/devnet/submit-api.bat new file mode 100644 index 00000000..7b735b3e --- /dev/null +++ b/applications/cli/src/main/resources/localcluster/templates/devnet/submit-api.bat @@ -0,0 +1,9 @@ +@echo off +setlocal enabledelayedexpansion + +"${BIN_FOLDER}\cardano-submit-api.exe" --config submit-api-config.yaml ^ + --testnet-magic ${PROTOCOL_MAGIC} ^ + --socket-path node\node.sock ^ + --port ${SUBMIT_API_PORT} ^ + --listen-address 0.0.0.0 ^ + --metrics-port 0 From b449ae64384b0f45455478b716b3997b2378d96a Mon Sep 17 00:00:00 2001 From: Satya Date: Sun, 1 Dec 2024 19:08:11 +0800 Subject: [PATCH 10/10] Add native docker build support and update version tag --- Earthfile | 3 +- applications/cli/Earthfile | 75 +++++++++++++++++++ applications/cli/docker/download-arm64.sh | 2 +- .../cli/docker/download-yaci-store.sh | 30 ++++++++ config/version | 2 +- 5 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 applications/cli/docker/download-yaci-store.sh diff --git a/Earthfile b/Earthfile index c05524d7..6cf2ef79 100644 --- a/Earthfile +++ b/Earthfile @@ -22,7 +22,8 @@ cli-docker: ARG EARTHLY_TARGET_NAME ARG EARTHLY_GIT_SHORT_HASH - BUILD ./applications/cli+docker-build --BUILD_TYPE=${build_type} --REGISTRY_ORG=${REGISTRY_ORG} --APP_VERSION=${tag} --COMMIT_ID=${EARTHLY_GIT_SHORT_HASH} + #BUILD ./applications/cli+docker-build --BUILD_TYPE=${build_type} --REGISTRY_ORG=${REGISTRY_ORG} --APP_VERSION=${tag} --COMMIT_ID=${EARTHLY_GIT_SHORT_HASH} + BUILD ./applications/cli+docker-build-native --BUILD_TYPE=${build_type} --REGISTRY_ORG=${REGISTRY_ORG} --APP_VERSION=${tag} --COMMIT_ID=${EARTHLY_GIT_SHORT_HASH} viewer: ARG EARTHLY_TARGET_NAME diff --git a/applications/cli/Earthfile b/applications/cli/Earthfile index c22b2b4b..f5f0f56d 100644 --- a/applications/cli/Earthfile +++ b/applications/cli/Earthfile @@ -132,3 +132,78 @@ docker-build: ENTRYPOINT ["sh", "/app/yaci-cli.sh"] SAVE IMAGE --push ${REGISTRY_ORG}/yaci-cli:${APP_VERSION} + +docker-build-native: + FROM ubuntu:22.04 + + ARG TARGETOS + ARG TARGETARCH + ARG BUILD_TYPE + ARG APP_VERSION + ARG REGISTRY_ORG + ARG COMMIT_ID + + COPY docker/install-packages.sh . + RUN chmod -R 755 install-packages.sh + RUN ./install-packages.sh + + #RUN apk update && apk --no-cache add wget && apk --no-cache add zip && apk --no-cache add unzip + #RUN apk --no-cache add zstd + #RUN apk --no-cache add curl + #RUN apk --no-cache add socat + + RUN mkdir "/app" + + WORKDIR /app + + COPY docker/download-$TARGETARCH.sh . + RUN sh download-$TARGETARCH.sh + + #Ogmios download + COPY docker/download-ogmios.sh . + RUN sh download-ogmios.sh $TARGETARCH + + #Kupo download + COPY docker/download-kupo.sh . + RUN sh download-kupo.sh $TARGETARCH + + #Yaci Store download + COPY docker/download-yaci-store.sh . + RUN sh download-yaci-store.sh $TARGETARCH + + #RUN apk --no-cache add curl + + RUN echo "I'm building for $TARGETOS/$TARGETARCH" + + RUN mkdir -p /app/store/config + COPY docker/store-application.properties /app/store/config/application.properties + + + RUN echo "Build type: $BUILD_TYPE" + IF [ "$BUILD_TYPE" = "native" ] + COPY (+cli-native/yaci-cli* --APP_VERSION=${APP_VERSION}) /app/ + ELSE IF [ "$BUILD_TYPE" = "native-ci" ] + COPY (+cli-native-ci/yaci-cli* --APP_VERSION=${APP_VERSION}) /app/ + END + + COPY docker/yaci-cli.sh /app/ + RUN chmod +x /app/yaci-cli.sh + + RUN mkdir -p /app/config + COPY docker/application.properties /app/config/ + + ENV PATH="$PATH:/app/cardano-bin" + ENV CARDANO_NODE_SOCKET_PATH=/clusters/nodes/default/node/node.sock + ENV PROTOCOL_MAGIC=42 + + WORKDIR /app + EXPOSE 3001 + EXPOSE 8090 + EXPOSE 10000 + EXPOSE 8080 + EXPOSE 1337 + EXPOSE 1442 + + ENTRYPOINT ["sh", "/app/yaci-cli.sh"] + + SAVE IMAGE --push ${REGISTRY_ORG}/yaci-cli:${APP_VERSION} diff --git a/applications/cli/docker/download-arm64.sh b/applications/cli/docker/download-arm64.sh index b74533be..a000be34 100755 --- a/applications/cli/docker/download-arm64.sh +++ b/applications/cli/docker/download-arm64.sh @@ -1,6 +1,6 @@ file=cardano-10_1_2-aarch64-static-musl-ghc_966.tar.zst dir=cardano-10_1_2-aarch64-static-musl-ghc_966 -wget https://github.com/armada-alliance/cardano-node-binaries/raw/main/static-binaries/$file?raw=true -O - | tar -I zstd -xv +wget https://github.com/armada-alliance/cardano-node-binaries/raw/main/static-binaries/$file?raw=true -O - | zstd -dc | tar -xvf - #unzip $file mv $dir cardano-node diff --git a/applications/cli/docker/download-yaci-store.sh b/applications/cli/docker/download-yaci-store.sh new file mode 100644 index 00000000..c246f10a --- /dev/null +++ b/applications/cli/docker/download-yaci-store.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# Assign the architecture based on user input and determine the correct suffix +case $1 in + amd64) + SUFFIX="x86_64" + ;; + arm64) + SUFFIX="aarch64" + ;; + *) + echo "Error: Invalid architecture specified. Use 'amd64' or 'arm64'." + exit 1 + ;; +esac + + +version=0.1.1-graalvm-preview2 +file=yaci-store-${version}-linux-musl-x64-n2c.zip +wget https://github.com/bloxbean/yaci-store/releases/download/rel-graal-${version}/$file + +mkdir /app/store +unzip $file -d /app/store + +cp /app/store/yaci-store-${version}-n2c/yaci-store /app/store/yaci-store +rm -rf /app/store/yaci-store-${version}-n2c + +chmod +x /app/store/yaci-store + +rm $file diff --git a/config/version b/config/version index 9ca1b6d8..6dceb23b 100644 --- a/config/version +++ b/config/version @@ -1,2 +1,2 @@ -tag=0.10.0-preview2 +tag=0.10.0-preview2-alpine revision=