Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
  • Loading branch information
martabal committed Mar 7, 2024
1 parent 34ce0ca commit 739e73e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ jobs:
- name: Set tags
id: tags
run: |
if [ "${{ inputs.version }}" != '' ]; then
echo "immich_version=${{ inputs.version }}" >> $GITHUB_OUTPUT
else
immich_version=$(curl -sL https://api.github.com/repos/immich-app/immich/releases/latest | jq -r '.tag_name')
echo "immich_version=${immich_version}" >> $GITHUB_OUTPUT
fi
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
- name: Create Dockerfile from template
run: python3 render_templates.py
Expand All @@ -63,10 +71,10 @@ jobs:
ghcr.io/${{ github.repository_owner }}/immich
tags: |
type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' }},suffix=${{ matrix.suffix }}
type=ref,event=branch,enable=${{ github.event_name != 'workflow_dispatch' }}
type=ref,event=pr
type=ref,event=pr,value=${{ steps.tags.outputs.immich_version }},enable=${{ github.event_name == 'pull_request' }},suffix=-${{github.event.number}}
type=raw,value=${{ matrix.image }},enable=${{ matrix.image != 'classic' }}
type=raw,value=${{ inputs.version }},enable=${{ github.event_name == 'workflow_dispatch' }},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
Expand All @@ -93,4 +101,4 @@ jobs:
tags: ${{ steps.metadata.outputs.tags }}
build-args: |
BUILD_VERSION=${{ steps.tags.outputs.build_date }}
IMMICH_VERSION=${{ inputs.version }}
IMMICH_VERSION=${{ steps.tags.outputs.immich_version }}
4 changes: 0 additions & 4 deletions render_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,16 @@
"name": "cuda",
"machine_learning_provider": "cuda",
"render_name": True,
"cpu_architecture": "amd64",
},
{
"name": "openvino",
"machine_learning_provider": "openvino",
"render_name": True,
"cpu_architecture": "amd64",
},
{
"name": "classic",
"machine_learning_provider": "cpu",
"render_name": False,
"cpu_architecture": "amd64",
},
],
"name": "main",
Expand All @@ -36,7 +33,6 @@
"name": "classic",
"machine_learning_provider": None,
"render_name": False,
"cpu_architecture": "amd64",
},
],
"name": "noml",
Expand Down
7 changes: 3 additions & 4 deletions templates/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@ ENV \
{% if machine_learning == True -%}
IMMICH_MACHINE_LEARNING_URL="http://127.0.0.1:3003" \
MACHINE_LEARNING_CACHE_FOLDER="/config/machine-learning" \
TRANSFORMERS_CACHE="/config/machine-learning" \
{% else -%}
IMMICH_MACHINE_LEARNING_ENABLED="false" \
{% endif -%}
{% if cpu_architecture == "amd64" -%}
NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \
TRANSFORMERS_CACHE="/config/machine-learning" \
{% endif -%}
IMMICH_MEDIA_LOCATION="/photos" \
IMMICH_REVERSE_GEOCODING_ROOT="/app/immich/geodata" \
IMMICH_WEB_ROOT="/app/immich/server/www" \
NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \
SERVER_PORT="8080"

# run build
Expand All @@ -36,6 +34,7 @@ RUN \
{% endif -%}
apt-get update && \
apt-get install --no-install-recommends -y \
$(if [ $(arch) = "x86_64" ]; then echo "intel-media-va-driver-non-free"; fi) \
autoconf \
bc \
build-essential \
Expand Down

0 comments on commit 739e73e

Please sign in to comment.