forked from autonomys/subspace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c56d286
commit 059cb88
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# This action enables building container images for farmer and node, can be triggered manually or by release creation. | ||
# | ||
# Container images are only pushed to GitHub Container Registry. | ||
name: Docker build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- '**' | ||
tags: | ||
- '**' | ||
|
||
# Incremental compilation here isn't helpful | ||
env: | ||
CARGO_INCREMENTAL: 0 | ||
|
||
jobs: | ||
container-linux: | ||
runs-on: ubuntu-22.04 | ||
permissions: | ||
contents: write | ||
packages: write | ||
strategy: | ||
matrix: | ||
image: | ||
- farmer | ||
- node | ||
platform: | ||
- arch: linux/amd64 | ||
profile: production | ||
suffix: ubuntu-x86_64-${{ github.ref_name }} | ||
image-suffix: '' | ||
|
||
steps: | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Log into registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Extract Docker metadata | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: | | ||
# The final created images will be `ghcr.io/subspace/{node, farmer}` under subspace organization, | ||
# hence adding a prefix `subspace-` for a fork repo, the final image will be: | ||
# - ghcr.io/liuchengxu/subspace-node:tag | ||
# - ghcr.io/liuchengxu/subspace-farmer:tag | ||
ghcr.io/${{ github.repository_owner }}/subspace-${{ matrix.image }} | ||
tags: | | ||
type=ref,event=tag | ||
type=ref,event=branch | ||
type=sha | ||
flavor: | | ||
latest=false | ||
suffix=${{ matrix.platform.image-suffix }} | ||
- name: Build and push ${{ matrix.image }} image | ||
id: build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
file: Dockerfile-${{ matrix.image }} | ||
platforms: ${{ matrix.platform.arch }} | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: | | ||
SUBSTRATE_CLI_GIT_COMMIT_HASH=${{ github.sha }} | ||
PROFILE=${{ matrix.platform.profile }} | ||
RUSTFLAGS=-C strip=debuginfo |