| 1 |
sysadm |
1.1 |
# This workflow uses actions that are not certified by GitHub.
|
| 2 |
|
|
# They are provided by a third-party and are governed by
|
| 3 |
|
|
# separate terms of service, privacy policy, and support
|
| 4 |
|
|
# documentation.
|
| 5 |
|
|
|
| 6 |
|
|
# GitHub recommends pinning actions to a commit SHA.
|
| 7 |
|
|
# To get a newer version, you will need to update the SHA.
|
| 8 |
|
|
# You can also reference a tag or branch, but the action may change without warning.
|
| 9 |
|
|
|
| 10 |
|
|
name: Publish Docker image
|
| 11 |
|
|
|
| 12 |
|
|
on:
|
| 13 |
|
|
release:
|
| 14 |
|
|
types: [published]
|
| 15 |
|
|
|
| 16 |
sysadm |
1.2 |
concurrency:
|
| 17 |
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
| 18 |
|
|
cancel-in-progress: true
|
| 19 |
|
|
|
| 20 |
sysadm |
1.1 |
env:
|
| 21 |
|
|
DOCKERHUB_PLATFORMS: linux/amd64,linux/arm64
|
| 22 |
|
|
APACHE_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/lbbs-apache
|
| 23 |
|
|
PHP_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/lbbs-php
|
| 24 |
|
|
|
| 25 |
|
|
jobs:
|
| 26 |
|
|
push_to_registry:
|
| 27 |
|
|
name: Push Docker image to Docker Hub
|
| 28 |
|
|
runs-on: ubuntu-latest
|
| 29 |
|
|
permissions:
|
| 30 |
|
|
packages: write
|
| 31 |
|
|
contents: read
|
| 32 |
|
|
attestations: write
|
| 33 |
|
|
id-token: write
|
| 34 |
|
|
steps:
|
| 35 |
|
|
- name: Check out the repo
|
| 36 |
|
|
uses: actions/checkout@v5
|
| 37 |
|
|
|
| 38 |
|
|
- name: Log in to Docker Hub
|
| 39 |
|
|
uses: docker/login-action@v3
|
| 40 |
|
|
with:
|
| 41 |
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
| 42 |
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
| 43 |
|
|
|
| 44 |
|
|
- name: Set up QEMU
|
| 45 |
|
|
uses: docker/setup-qemu-action@v3
|
| 46 |
|
|
|
| 47 |
|
|
- name: Set up Docker Buildx
|
| 48 |
|
|
uses: docker/setup-buildx-action@v3
|
| 49 |
|
|
|
| 50 |
sysadm |
1.2 |
- name: Extract Docker metadata (apache)
|
| 51 |
|
|
id: meta-apache
|
| 52 |
|
|
uses: docker/metadata-action@v5
|
| 53 |
|
|
with:
|
| 54 |
|
|
images: ${{ env.APACHE_IMAGE }}
|
| 55 |
|
|
|
| 56 |
|
|
- name: Extract Docker metadata (php)
|
| 57 |
|
|
id: meta-php
|
| 58 |
|
|
uses: docker/metadata-action@v5
|
| 59 |
|
|
with:
|
| 60 |
|
|
images: ${{ env.PHP_IMAGE }}
|
| 61 |
|
|
|
| 62 |
sysadm |
1.1 |
- name: Build and push Docker image (apache)
|
| 63 |
|
|
id: push-apache
|
| 64 |
|
|
uses: docker/build-push-action@v5
|
| 65 |
|
|
with:
|
| 66 |
|
|
platforms: ${{ env.DOCKERHUB_PLATFORMS }}
|
| 67 |
|
|
context: .
|
| 68 |
|
|
file: ./Dockerfile/dockerfile.apache
|
| 69 |
|
|
push: true
|
| 70 |
|
|
tags: |
|
| 71 |
|
|
${{ env.APACHE_IMAGE }}:${{ github.ref_name }}
|
| 72 |
|
|
${{ env.APACHE_IMAGE }}:latest
|
| 73 |
sysadm |
1.2 |
${{ steps.meta-apache.outputs.tags }}
|
| 74 |
|
|
labels: ${{ steps.meta-apache.outputs.labels }}
|
| 75 |
|
|
cache-from: type=gha # Pull cache from GitHub Actions cache
|
| 76 |
|
|
cache-to: type=gha,mode=max # Push cache to GitHub Actions cache
|
| 77 |
sysadm |
1.1 |
|
| 78 |
|
|
- name: Build and push Docker image (php)
|
| 79 |
|
|
id: push-php
|
| 80 |
|
|
uses: docker/build-push-action@v5
|
| 81 |
|
|
with:
|
| 82 |
|
|
platforms: ${{ env.DOCKERHUB_PLATFORMS }}
|
| 83 |
|
|
context: .
|
| 84 |
|
|
file: ./Dockerfile/dockerfile.php
|
| 85 |
|
|
push: true
|
| 86 |
|
|
tags: |
|
| 87 |
|
|
${{ env.PHP_IMAGE }}:${{ github.ref_name }}
|
| 88 |
|
|
${{ env.PHP_IMAGE }}:latest
|
| 89 |
sysadm |
1.2 |
${{ steps.meta-php.outputs.tags }}
|
| 90 |
|
|
labels: ${{ steps.meta-php.outputs.labels }}
|
| 91 |
|
|
cache-from: type=gha # Pull cache from GitHub Actions cache
|
| 92 |
|
|
cache-to: type=gha,mode=max # Push cache to GitHub Actions cache
|