|
name: Docker Image CI |
|
|
|
on: |
|
push: |
|
branches: |
|
- main |
|
workflow_dispatch: |
|
|
|
jobs: |
|
build-and-push: |
|
runs-on: ubuntu-latest |
|
permissions: |
|
packages: write |
|
contents: read |
|
steps: |
|
- uses: actions/checkout@v4 |
|
|
|
- name: Set up QEMU |
|
uses: docker/setup-qemu-action@v3 |
|
|
|
- name: Set up Docker Buildx |
|
uses: docker/setup-buildx-action@v3 |
|
|
|
- name: Login to GitHub Container Registry |
|
uses: docker/login-action@v3 |
|
with: |
|
registry: ghcr.io |
|
username: ${{ github.actor }} |
|
password: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
- name: Set repository owner to lowercase |
|
id: repo_owner |
|
run: echo "owner_lc=${GITHUB_REPOSITORY_OWNER,,}" >> $GITHUB_ENV |
|
|
|
- name: Build and push Docker image to GHCR |
|
uses: docker/build-push-action@v5 |
|
with: |
|
context: . |
|
file: ./Dockerfile |
|
push: true |
|
tags: ghcr.io/${{ env.owner_lc }}/od2api_plus:latest |
|
|
|
- name: Logout from GitHub Container Registry |
|
run: docker logout ghcr.io |
|
|