Skip to content

Commit

Permalink
wip merge
Browse files Browse the repository at this point in the history
  • Loading branch information
zackpollard committed Jan 23, 2025
1 parent 9a593cb commit aa62f30
Showing 1 changed file with 78 additions and 73 deletions.
151 changes: 78 additions & 73 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
pre-job:
runs-on: ubuntu-latest
outputs:
# TODO: Remove true in checks below
should_run_server: ${{ steps.found_paths.outputs.server == 'true' || steps.should_force.outputs.should_force == 'true' || true }}
should_run_ml: ${{ steps.found_paths.outputs.machine-learning == 'true' || steps.should_force.outputs.should_force == 'true' }}
steps:
Expand Down Expand Up @@ -243,25 +244,6 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Generate docker image tags
# id: metadata
# uses: docker/metadata-action@v5
# with:
# flavor: |
# # Disable latest tag
# latest=false
# images: |
# name=ghcr.io/${{ github.repository_owner }}/${{env.image}}
# name=altran1502/${{env.image}},enable=${{ github.event_name == 'release' }}
# tags: |
# # Tag with branch name
# type=ref,event=branch,suffix=${{ matrix.suffix }}
# # Tag with pr-number
# type=ref,event=pr,suffix=${{ matrix.suffix }}
# # Tag with git tag on release
# type=ref,event=tag,suffix=${{ matrix.suffix }}
# type=raw,value=release,enable=${{ github.event_name == 'release' }},suffix=${{ matrix.suffix }}

- name: Determine build cache output
id: cache-target
run: |
Expand All @@ -282,8 +264,8 @@ jobs:
platforms: ${{ matrix.platform }}
# Skip pushing when PR from a fork
push: ${{ !github.event.pull_request.head.repo.fork }}
cache-from: ${{ steps.cache-target.outputs.cache-from }}
cache-to: ${{ steps.cache-target.outputs.cache-to }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository_owner }}/immich-build-cache:${{env.image}}-${{env.PLATFORM_PAIR}}
cache-to: type=registry,mode=max,ref=ghcr.io/${{ github.repository_owner }}/immich-build-cache:${{ env.image }}-${{env.PLATFORM_PAIR}}
labels: ${{ steps.metadata.outputs.labels }}
outputs: type=image,"name=ghcr.io/${{ github.repository_owner }}/${{env.image}}",push-by-digest=true,name-canonical=true,push=true
build-args: |
Expand All @@ -307,59 +289,82 @@ jobs:
if-no-files-found: error
retention-days: 1

# merge:
# runs-on: ubuntu-latest
# needs:
# - build
# steps:
# - name: Download digests
# uses: actions/download-artifact@v4
# with:
# path: ${{ runner.temp }}/digests
# pattern: digests-*
# merge-multiple: true
#
# - name: Login to Docker Hub
# uses: docker/login-action@v3
# with:
# username: ${{ vars.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: Login to GHCR
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
#
merge_server:
runs-on: ubuntu-latest
env:
GHCR_REPO: ghcr.io/${{ github.repository_owner }}/immich-server
DOCKER_REPO: altran1502/immich-server
needs:
- build_and_push_server
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

# - name: Docker meta
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: |
# ${{ env.DOCKERHUB_REPO }}
# ${{ env.GHCR_REPO }}
# tags: |
# type=ref,event=branch
# type=ref,event=pr
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
#
# - name: Create manifest list and push
# working-directory: ${{ runner.temp }}/digests
# run: |
# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
# $(printf '${{ env.DOCKERHUB_REPO }}@sha256:%s ' *)
# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
# $(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
#
# - name: Inspect image
# run: |
# docker buildx imagetools inspect ${{ env.DOCKERHUB_REPO }}:${{ steps.meta.outputs.version }}
# docker buildx imagetools inspect ${{ env.GHCR_REPO }}:${{ steps.meta.outputs.version }}
# id: meta
# uses: docker/metadata-action@v5
# with:
# images: |
# # ${{ env.DOCKERHUB_REPO }}
# ${{ env.GHCR_REPO }}
# tags: |
# type=ref,event=branch
# type=ref,event=pr
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}

- name: Generate docker image tags
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
# Disable latest tag
latest=false
images: |
name=ghcr.io/${{ github.repository_owner }}/immich-server
# name=altran1502/immich-server,enable=${{ github.event_name == 'release' }}
tags: |
# Tag with branch name
type=ref,event=branch,suffix=${{ matrix.suffix }}
# Tag with pr-number
type=ref,event=pr,suffix=${{ matrix.suffix }}
# Tag with git tag on release
type=ref,event=tag,suffix=${{ matrix.suffix }}
type=raw,value=release,enable=${{ github.event_name == 'release' }},suffix=${{ matrix.suffix }}
# docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
# $(printf '${{ env.DOCKERHUB_REPO }}@sha256:%s ' *)

- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.GHCR_REPO }}@sha256:%s ' *)
- name: Inspect image
run: |
# docker buildx imagetools inspect ${{ env.DOCKERHUB_REPO }}:${{ steps.meta.outputs.version }}
docker buildx imagetools inspect ${{ env.GHCR_REPO }}:${{ steps.meta.outputs.version }}
success-check-server:
name: Docker Build & Push Server Success
Expand Down

0 comments on commit aa62f30

Please sign in to comment.