Skip to content

Merge pull request #14 from AngusP/2024-06-14-package-update #2

Merge pull request #14 from AngusP/2024-06-14-package-update

Merge pull request #14 from AngusP/2024-06-14-package-update #2

name: "Update image when Dockerfile is changed"
on:
push:
branches:
- master
paths:
- 'Dockerfile'
workflow_dispatch:
jobs:
rebuild-container:
name: "Rebuild Container with the latest base image"
runs-on: ubuntu-latest
steps:
-
name: Prepare outputs
id: prep
run: |
echo "::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
with:
platforms: linux/arm64
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.1.0
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3.0.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Set lower case owner name
run: |
echo "REPOSITORY_OWNER_LC=${OWNER@L}" >>${GITHUB_ENV}
env:
OWNER: '${{ github.repository_owner }}'
-
name: Create .env config file
run: |
cp phoenixd-lnurl.env.example phoenixd-lnurl.env
-
name: Build x86_64 image
id: docker_build_amd64
uses: docker/build-push-action@v5.2.0
with:
context: '.'
push: false
load: true
platforms: linux/amd64
tags: phoenixd-lnurl:amd64
cache-from: type=registry,ref=ghcr.io/${{ env.REPOSITORY_OWNER_LC }}/phoenixd-lnurl:latest
cache-to: type=inline
-
name: Test-run x86_64 image
run: |
docker run --rm phoenixd-lnurl:amd64 &
PID=$!
sleep 10
kill -SIGINT $PID # this will return a non-zero exit code if the container dies early on
-
name: Build and push to Docker Hub and GitHub Packages Docker Registry
uses: docker/build-push-action@v5.2.0
id: docker_build_push
with:
context: '.'
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ env.REPOSITORY_OWNER_LC }}/phoenixd-lnurl:latest
labels: |
org.opencontainers.image.source=${{ github.event.repository.html_url }}
org.opencontainers.image.created=${{ steps.prep.outputs.created }}
org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=registry,ref=ghcr.io/${{ env.REPOSITORY_OWNER_LC }}/phoenixd-lnurl:latest
cache-to: type=inline