From 19025d8906b448b760a0c968e171f1e89925e221 Mon Sep 17 00:00:00 2001 From: Matthew Dean Date: Thu, 24 Oct 2024 15:21:55 +0100 Subject: [PATCH] Update IPFS version in Dockerfile (#281) * Update IPFS version in Dockerfile * Set ipfs version based on package dependency * Updating version to 2.10.91 --------- Co-authored-by: dc-autobot[bot] <181364585+dc-autobot[bot]@users.noreply.github.com> --- .github/workflows/release.yml | 6 ++++++ .github/workflows/tests.yml | 8 +++++++- Dockerfile | 15 +++++++++------ README.md | 10 +++++++++- package-lock.json | 4 ++-- package.json | 2 +- 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb68e0f..b8c927a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -134,6 +134,10 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Get Kubo Version + id: kubo_version + run: | + echo "IPFS_TAG=v$(jq .devDependencies.kubo ./package.json | sed 's/[\^"]//g')" >> $GITHUB_OUTPUT # Docker build - name: Setup QEMU @@ -164,6 +168,8 @@ jobs: context: . file: ./Dockerfile platforms: linux/amd64, linux/arm64 + build-args: | + IPFS_TAG=${{ steps.kubo_version.outputs.IPFS_TAG }} tags: | ghcr.io/${{ needs.preconditions.outputs.org_name }}/${{ needs.preconditions.outputs.repo_name }}:${{ needs.check-version.outputs.version }} ${{ needs.preconditions.outputs.org_name }}/${{ needs.preconditions.outputs.repo_name }}:${{ needs.check-version.outputs.version }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6270c67..ff4b567 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -120,7 +120,10 @@ jobs: steps: - uses: actions/checkout@v4 - + - name: Get Kubo Version + id: kubo_version + run: | + echo "IPFS_TAG=v$(jq .devDependencies.kubo ./package.json | sed 's/[\^"]//g')" >> $GITHUB_OUTPUT # Docker build - name: Setup QEMU uses: docker/setup-qemu-action@v3 @@ -139,3 +142,6 @@ jobs: context: . file: ./Dockerfile platforms: linux/amd64, linux/arm64 + build-args: | + IPFS_TAG=${{ steps.kubo_version.outputs.IPFS_TAG }} + diff --git a/Dockerfile b/Dockerfile index 0a9ccba..3d11f1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,8 @@ # syntax=docker/dockerfile:1.10 -FROM golang:1.21-alpine3.17 AS ipfs_build +FROM golang:1.23-alpine3.19 AS ipfs_build -ENV SRC_DIR /go/src/github.com/ipfs/kubo +ENV SRC_DIR=/go/src/github.com/ipfs/kubo ARG TARGETPLATFORM RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then apk add --no-cache binutils-gold; fi @@ -10,25 +10,28 @@ RUN apk add --no-cache git make bash gcc musl-dev WORKDIR /target -ARG IPFS_TAG="v0.26.0" +ARG IPFS_TAG=NO_VALUE +RUN [ ! "${IPFS_TAG}" == "NO_VALUE" ] + +RUN echo $IPFS_TAG RUN < install dependencies @@ -31,3 +31,11 @@ npm run dev | IPFS_EXECUTABLE | N | `ipfs` | Executable to use to run go-ipfs | | IPFS_ARGS | N | `["daemon"]` | JSON array of strings to pass as arguments to the `IPFS_EXECUTABLE` | | IPFS_LOG_LEVEL | N | `info` | Log level of the go-ipfs child process | + +## Docker build + +`sqnc-ipfs` can be built into a docker container. There is a required build argument for this `IPFS_TAG` which specifies what version of `kubo` should be built into `sqnc-ipfs`. The container can therefore be built using: + +```sh +docker build --build-arg IPFS_TAG="v0.31.0" . +``` diff --git a/package-lock.json b/package-lock.json index f3f3cf9..a9b2564 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@digicatapult/sqnc-ipfs", - "version": "2.10.90", + "version": "2.10.91", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@digicatapult/sqnc-ipfs", - "version": "2.10.90", + "version": "2.10.91", "license": "Apache-2.0", "dependencies": { "@polkadot/api": "^14.1.1", diff --git a/package.json b/package.json index 15ad5a1..a861f96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@digicatapult/sqnc-ipfs", - "version": "2.10.90", + "version": "2.10.91", "description": "IPFS node for use in SQNC", "main": "app/index.js", "type": "module",