Skip to content

Build Docker image in CI #4

Build Docker image in CI

Build Docker image in CI #4

Workflow file for this run

name: Docker
on:
push:
tags:
- 'v*'
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: |
name=ghcr.io/cartesi/rollups-explorer-api
name=docker.io/cartesi/rollups-explorer-api,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
tags: |
type=semver,pattern={{version}}
type=ref,event=branch
type=ref,event=pr
- name: Login to Docker Hub
uses: docker/login-action@v2
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: depot/setup-action@v1
- name: Build and push docker image
id: docker_build
uses: depot/bake-action@v1
with:
files: |
./docker-bake.hcl
${{ steps.docker_meta.outputs.bake-file }}
./docker-bake.platforms.hcl
push: true
project: ${{ vars.DEPOT_PROJECT }}