Skip to content

feat: build libjxl #508

feat: build libjxl

feat: build libjxl #508

Workflow file for this run

name: Docker build
on:
workflow_dispatch:
inputs:
version:
description: "version"
required: false
type: string
push:
branches: ["main"]
paths:
- "templates/**"
- "root/**"
- ".github/**"
pull_request:
branches: ["main"]
paths:
- "templates/**"
- "root/**"
- ".github/**"
schedule:
- cron: "0 12 * * 3"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
packages: write
jobs:
build_docker:
name: build docker images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: armnn
platforms: linux/arm64
suffix: -armnn
- image: cuda
platforms: linux/amd64
suffix: -cuda
- image: cpu
platforms: linux/amd64,linux/arm64
- image: noml
platforms: linux/amd64,linux/arm64
suffix: -noml
- image: openvino
platforms: linux/amd64
suffix: -openvino
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set tags
id: tags
run: |
echo "Generate tags"
if [ "${{ inputs.version }}" != '' ]; then
immich_version="${{ inputs.version }}"
else
immich_version=$(curl -sL https://api.github.com/repos/immich-app/immich/releases/latest | jq -r '.tag_name')
counter=0
# Loop until immich_version is not "null" or counter reaches 10
while [ $counter -lt 10 ]; do
immich_version=$(curl -sL https://api.github.com/repos/immich-app/immich/releases/latest | jq -r '.tag_name')
# Check if immich_version is not "null"
if [ "$immich_version" != "null" ]; then
echo "immich_version is not null: $immich_version"
break
else
echo "immich_version is still null, retrying in 10 seconds..."
sleep 10
((counter++))
fi
done
if [ "$immich_version" = "null" ]; then
echo "immich_version is still null after 10 attempts, exiting..."
exit 1
fi
fi
short_version="${immich_version#v}"
echo "immich_version=${immich_version}" >> $GITHUB_OUTPUT
echo "build_date=$(date +'%Y-%m-%dT%H:%M:%S%:z')" >> $GITHUB_OUTPUT
echo "short_date=$(date '+%Y%m%d')" >> $GITHUB_OUTPUT
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "short_version=${short_version}" >> $GITHUB_OUTPUT
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install poetry
run: pipx install poetry
- name: Setup poetry
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: "poetry"
- name: Install python dependencies
run: poetry install --without dev,test
- name: Create Dockerfile from template
run: poetry run python3 render_templates/main.py --flavor ${{ matrix.image }} --print-dockerfile
- name: Generate docker image tags
id: metadata
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/immich
tags: |
type=ref,event=pr,value=${{ steps.tags.outputs.immich_version }},enable=${{ github.event_name == 'pull_request' }},suffix=${{ matrix.suffix }}
type=ref,event=pr,value=${{ steps.tags.outputs.immich_version }},enable=${{ github.event_name == 'pull_request' }},suffix=${{ matrix.suffix }}-${{ steps.tags.outputs.immich_version }}
type=ref,event=pr,value=${{ steps.tags.outputs.immich_version }},enable=${{ github.event_name == 'pull_request' }},suffix=${{ matrix.suffix }}-${{ steps.tags.outputs.immich_version }}-${{ steps.tags.outputs.commit }}
type=raw,value=latest,enable=${{ github.event_name != 'pull_request' }},suffix=${{ matrix.suffix }}
type=raw,value=${{ matrix.image }},enable=${{ matrix.image != 'cpu' && github.event_name != 'pull_request' }}
type=raw,value=${{ steps.tags.outputs.short_version }},enable=${{ github.event_name != 'pull_request' }},suffix=${{ matrix.suffix }}
type=raw,value=${{ steps.tags.outputs.immich_version }},enable=${{ github.event_name != 'pull_request' }},suffix=${{ matrix.suffix }}
type=raw,value=${{ steps.tags.outputs.immich_version }},enable=${{ github.event_name != 'pull_request' }},suffix=${{ matrix.suffix }}-${{ steps.tags.outputs.short_date }}-${{ steps.tags.outputs.commit }}
- 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.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker images
uses: docker/build-push-action@v6
with:
context: build-${{ matrix.image }}
provenance: false # prevent unknown architecture
platforms: ${{ matrix.platforms }}
push: ${{ !github.event.pull_request.head.repo.fork }}
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}
build-args: |
BUILD_VERSION=${{ steps.tags.outputs.build_date }}
BUILD_ID=${{ github.run_id }}
BUILD_IMAGE=${{ matrix.image == 'cpu' && 'latest' || matrix.image }}
BUILD_IMAGE_URL=https://github.com/${{ github.repository }}/pkgs/container/immich
BUILD_REPOSITORY=${{ github.repository }}
BUILD_REPOSITORY_URL=https://github.com/${{ github.repository }}
BUILD_SOURCE_COMMIT=${{ github.sha }}
BUILD_SOURCE_REF=${{ github.ref_name }}
BUILD_SOURCE_URL=https://github.com/${{ github.repository }}/commit/${{ github.sha }}
BUILD_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
IMMICH_VERSION=${{ steps.tags.outputs.immich_version }}
THIRD_PARTY_BUG_FEATURE_URL=https://github.com/${{ github.repository }}/issues
THIRD_PARTY_DOCUMENTATION_URL=https://github.com/${{ github.repository }}/blob/main/README.md
THIRD_PARTY_SOURCE_URL=https://github.com/${{ github.repository }}
THIRD_PARTY_SUPPORT_URL=https://github.com/${{ github.repository }}/discussions