Skip to content

Create and publish a Docker image #4

Create and publish a Docker image

Create and publish a Docker image #4

name: Create and publish a Docker image
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Lowercase repository name
id: lowercase
run: echo "repository=${GITHUB_REPOSITORY@L}" >> $GITHUB_OUTPUT
- name: Log in to GHCR
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/[email protected]
with:
context: .
file: ./workshop/scenario_1/Dockerfile
push: true
tags: |
ghcr.io/${{ steps.lowercase.outputs.repository }}/bitcoinero:latest
ghcr.io/${{ steps.lowercase.outputs.repository }}/bitcoinero:${{ github.run_id }}