Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github/workflows: add multi platform docker image #348

Merged
merged 7 commits into from
Apr 6, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 21 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,37 @@ jobs:
runs-on: ubuntu-latest
name: Build Docker Image
steps:

- uses: actions/checkout@v2

- uses: docker/setup-buildx-action@v1

- id: get-version
run: |
version=$(echo "${{ github.sha }}" | cut -c1-8)
echo "::set-output name=version::$version"

- name: Publish to registry
uses: elgohr/Publish-Docker-Github-Action@3.04
env:
NODE_ENV: production
DOCKER_BUILDKIT: 1
- id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/obolnetwork/charon/charon
tags: "latest,${{steps.get-version.outputs.version}}"

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
name: ${{ github.repository }}/charon
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_REGISTRY_SECRET }}
buildargs: GITHUB_SHA=${{ github.sha }}
registry: ghcr.io
tags: "latest,${{steps.get-version.outputs.version}}"

- name: Publish to registry
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: GITHUB_SHA=${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
34 changes: 24 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,37 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- id: get-version
run: |
version=$(echo "${{ github.ref }}" | cut -d / -f 3)
version=$(echo "${{ github.sha }}" | cut -c1-8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this gets a tag, not a sha. So please revert and rename to get-tag

echo "::set-output name=version::$version"

- name: Publish to registry
uses: elgohr/Publish-Docker-Github-Action@3.02
env:
NODE_ENV: production
DOCKER_BUILDKIT: 1
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
name: ${{ github.repository }}/charon
images: |
ghcr.io/obolnetwork/charon/charon
tags: "latest,${{steps.get-version.outputs.version}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only push the tag, build already pushed latest


- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_REGISTRY_SECRET }}
buildargs: GITHUB_SHA=${{ github.sha }}
registry: ghcr.io
tags: "${{ steps.get-version.outputs.version }}"

- name: Publish to registry
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: GITHUB_SHA=${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}

- name: Generate cli reference
run: docker run ghcr.io/obolnetwork/charon/charon:${{steps.get-version.outputs.version}} charon run --help > cli-reference.txt
Expand Down