Skip to content

feat: add GitHub Docker build action #1

feat: add GitHub Docker build action

feat: add GitHub Docker build action #1

name: Build and Push Docker Image
on:
push:
branches:
- main
jobs:
push_to_docker_hub:
name: Build and Push to Docker Hub
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5
with:
images: implyapp/imply
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: |
implyapp/imply:latest
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: implyapp/imply