2024-09-20 01:04:01 -06:00
|
|
|
name: Build and Push Docker Image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-and-push:
|
|
|
|
runs-on: ubuntu-latest
|
2024-09-20 22:03:44 -06:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
2024-09-20 01:04:01 -06:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
2024-09-20 21:58:15 -06:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
2024-09-20 01:04:01 -06:00
|
|
|
|
2024-09-20 21:58:15 -06:00
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v1
|
2024-09-20 01:04:01 -06:00
|
|
|
with:
|
2024-09-20 21:58:15 -06:00
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
2024-09-20 01:04:01 -06:00
|
|
|
|
2024-09-20 21:58:15 -06:00
|
|
|
- name: Build and push
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: |
|
|
|
|
ghcr.io/${{ github.repository }}:${{ github.sha }}
|
|
|
|
ghcr.io/${{ github.repository }}:latest
|