Merge branch 'master' into ci/docker-cache #6874
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
# This workflow only build the docker images as a test. | |
# This images are not published, check Dockerfile.release for this. | |
# This images are only for dev/local purpose. | |
name: docker | |
on: | |
push: | |
branches: | |
- "master" | |
- "ci/docker-cache" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build-docker-image-main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Go Build Cache for Docker | |
uses: actions/cache@v3 | |
with: | |
path: go-build-cache | |
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-build-cache- | |
- name: inject go-build-cache into docker | |
uses: reproducible-containers/buildkit-cache-dance@v3.1.0 | |
with: | |
cache-source: go-build-cache | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=raw,value=latest | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-docker-images: | |
runs-on: ubuntu-latest | |
needs: build-docker-image-main | |
strategy: | |
matrix: | |
target: | |
- gnoland | |
- gnokey | |
- gno | |
- gnoweb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Go Build Cache for Docker | |
uses: actions/cache@v3 | |
with: | |
path: go-build-cache | |
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-build-cache- | |
- name: inject go-build-cache into docker | |
uses: reproducible-containers/buildkit-cache-dance@v3.1.0 | |
with: | |
cache-source: go-build-cache | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=raw,value=latest | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
target: ${{ matrix.target }} | |
platforms: linux/amd64,linux/arm64 | |
push: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |