Skip to content

Commit

Permalink
Publish Docker images to GitHub Container Registry (#440)
Browse files Browse the repository at this point in the history
In addition to Docker Hub, publish fabric-nodeenv Docker images to
GitHub Container Registry to improve availability.

Also:

- Remove redundant Azure Pipelines build definitions.
- Update the Ubuntu image versions used for the build.

Signed-off-by: Mark S. Lewis <[email protected]>
  • Loading branch information
bestbeforetoday authored Oct 14, 2024
1 parent 3c3d184 commit 7887093
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 454 deletions.
4 changes: 3 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
indent_size = 2

[*.{yaml,yml}]
indent_size = 2

[*.{mj,cj,j,t}s]
Expand Down
35 changes: 17 additions & 18 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,18 @@ on:
- "v2.*"
workflow_dispatch:

env:
DOCKER_REGISTRY: ${{ github.repository_owner == 'hyperledger' && 'docker.io' || 'ghcr.io' }}

jobs:
test:
uses: ./.github/workflows/test.yaml

publishnpm:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: test
steps:
- uses: actions/setup-node@v4
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- uses: actions/download-artifact@v4
with:
name: node-tgzs
Expand All @@ -37,43 +34,45 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publishdocker:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
DOCKER_REGISTRY:
- "docker.io"
- "ghcr.io"
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
config-inline: |
buildkitd-config-inline: |
[worker.oci]
max-parallelism = 1
- name: Checkout
uses: actions/checkout@v4

- name: Login to the ${{ env.DOCKER_REGISTRY }} Container Registry
- name: Login to the ${{ matrix.DOCKER_REGISTRY }} Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }}
password: ${{ env.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }}

registry: ${{ matrix.DOCKER_REGISTRY }}
username: ${{ matrix.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_USERNAME || github.actor }}
password: ${{ matrix.DOCKER_REGISTRY == 'docker.io' && secrets.DOCKERHUB_TOKEN || secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ github.repository_owner }}/fabric-nodeenv
images: ${{ matrix.DOCKER_REGISTRY }}/${{ github.repository_owner }}/fabric-nodeenv
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Build and push ${{ matrix.COMPONENT }} Image
- name: Build and push image
id: push
uses: docker/build-push-action@v5
with:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
setup:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
outputs:
PACKAGE_VERSION: ${{ steps.builddata.outputs.PACKAGE_VERSION }}
MINOR_PACKAGE_VERSION: ${{ steps.builddata.outputs.MINOR_PACKAGE_VERSION }}
Expand Down Expand Up @@ -37,12 +37,12 @@ jobs:
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: "18.x"
- name: Install/Rebuild/UnitTest
run: |
set -xev
Expand Down Expand Up @@ -74,13 +74,13 @@ jobs:
path: fabric-nodeenv.tar.gz

fvtest:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
node-version: "18.x"
- uses: actions/download-artifact@v4
with:
name: nodeenv-docker-image
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vulnerability-scan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# Pulling in all the dependencies it will be able to run NPM AUDIT, and if that returns a
# error code the job will fail.
scan:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down
Loading

0 comments on commit 7887093

Please sign in to comment.