Merge pull request #3 from lschloetterer/dependabot/docker/caddy-2.7.… #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build image | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- Dockerfile | |
permissions: | |
contents: read | |
packages: write | |
env: | |
IMAGE_NAME: ghcr.io/${{ github.repository }} | |
PLATFORMS: linux/arm/v7 | |
jobs: | |
build-image: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Retrieve image version | |
run: echo "IMAGE_VERSION=$(head -1 Dockerfile | grep -oP '(?<=caddy:).*?(?=-builder)')" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
platforms: ${{ env.PLATFORMS }} | |
push: true | |
tags: | | |
${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }} | |
${{ env.IMAGE_NAME }}:latest |