Build LaserWeb Docker Image for Linux x64 and Raspberry Pi (RPi2, RPi3, RPi4) #12
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 LaserWeb Docker Image for Linux x64 and Raspberry Pi (RPi2, RPi3, RPi4) | |
env: | |
REGISTRY: ghcr.io | |
NAME: laserweb | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
paths: | |
- '.github/workflows/*laserweb*' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- '.github/workflows/*laserweb*' | |
schedule: | |
- cron: '23 1 * * 0' # Sunday at 1:23 | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Set release date | |
run: | | |
echo "RELEASE_DATE=$(date --rfc-3339=date)" >> ${GITHUB_ENV} | |
- id: githubactor | |
uses: ASzc/change-string-case-action@v5 | |
with: | |
string: ${{ github.actor }} | |
- id: step2 | |
run: echo "IMAGE_NAME=ghcr.io/${{ steps.githubactor.outputs.lowercase }}/${{ env.NAME }}" >> ${GITHUB_ENV} | |
- name: Checkout builder factory repository | |
uses: actions/checkout@v3 | |
- name: Clone LaserWeb repository | |
run: | | |
git clone https://github.com/LaserWeb/LaserWeb4.git ./laserweb | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image for RPi2, RPi3, and RPi4 | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./laserweb/ | |
push: true | |
tags: | | |
${{ env.IMAGE_NAME }}:${{ env.RELEASE_DATE }} | |
${{ env.IMAGE_NAME }}:latest | |
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64 | |
labels: | | |
org.opencontainers.image.created=${{ env.RELEASE_DATE }} | |
org.opencontainers.image.version=latest |