Skip to content

Commit

Permalink
Update IPFS version in Dockerfile (#281)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
mattdean-digicatapult and dc-autobot[bot] authored Oct 24, 2024
1 parent 2e85f33 commit 19025d8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -139,3 +142,6 @@ jobs:
context: .
file: ./Dockerfile
platforms: linux/amd64, linux/arm64
build-args: |
IPFS_TAG=${{ steps.kubo_version.outputs.IPFS_TAG }}
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
# 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

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 <<EOF
set -ex
git clone --branch $IPFS_TAG https://github.com/ipfs/kubo.git $SRC_DIR
git clone --branch "$IPFS_TAG" https://github.com/ipfs/kubo.git $SRC_DIR
cd $SRC_DIR
make build
cp $SRC_DIR/cmd/ipfs/ipfs /target/ipfs
rm -rf $SRC_DIR
EOF

FROM node:lts-alpine3.17 AS runtime
FROM node:lts-alpine3.19 AS runtime
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then apk add --no-cache python3 make g++; fi
RUN apk add --no-cache curl
RUN npm i -g npm@latest

ARG LOGLEVEL
ENV NPM_CONFIG_LOGLEVEL ${LOGLEVEL}
ENV NPM_CONFIG_LOGLEVEL=${LOGLEVEL}

COPY --from=ipfs_build /target /usr/local/bin

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# sqnc-ipfs

Manages a go-ipfs instance maintaining the private network swarm key based on the value from a `sqnc-node` instance.
Manages a [kubo](https://docs.ipfs.tech/install/command-line/) instance maintaining the private network swarm key based on the value from a `sqnc-node` instance.

## Local development
> install dependencies
Expand Down Expand Up @@ -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" .
```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 19025d8

Please sign in to comment.