Skip to content

dockerize snapshot upload #4

dockerize snapshot upload

dockerize snapshot upload #4

name: Snapshot Service Image
# Cancel workflow if there is a new change to the branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
on:
push:
branches: [main]
tags:
- "*"
merge_group:
pull_request:
branches: [main]
jobs:
build-and-push-docker-image:
name: Build images and push to GHCR
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: List cached docker images
run: docker image ls
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Github Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step yields the following labels
# - date+sha, e.g. 2023-01-19-da4692d,
# - tag (if pushed).
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/chainsafe/forest-snapshot-service
flavor: |
latest=false
tags: |
type=raw,value={{date 'YYYY-MM-DD'}}-{{sha}}
type=ref,event=tag
type=edge
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v5
with:
context: ./images/snapshot-service/
build-contexts: |
common=./tf-managed/scripts/
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
- name: List docker images
run: docker image ls