Skip to content

Commit

Permalink
Merge pull request #122 from Salvoxia/fix/dockerBuildFails
Browse files Browse the repository at this point in the history
Fix/docker build fails
  • Loading branch information
Salvoxia authored Feb 3, 2025
2 parents d225b47 + 63036ad commit ff79a45
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,48 @@ jobs:
- name: Analysing the code with pylint
run: |
pylint $(git ls-files '*.py')
docker:
name: Build Docker Image
needs: lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Convert repository name ot image name
id: image_name
run: |
sed -E -e 's/docker-//' -e 's/^/image_name=/' <<<"${{ github.repository }}" >> "$GITHUB_OUTPUT"
- name: Generate Docker tag names
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ steps.image_name.outputs.image_name }}
${{ steps.image_name.outputs.image_name }}
# generate Docker tags based on the following events/attributes
tags: |
# set edge tag for default branch
type=edge,enable={{is_default_branch}}
# set dev tag for dev branch
type=raw,value=dev,enable=${{ github.ref == format('refs/heads/{0}', 'dev') }},branch=dev
# Tags for non SemVer tag names
type=match,pattern=([0-9]+.*),group=1
# latest tag for any tags
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }},event=tag
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
push: false
tags: ${{ steps.meta.outputs.tags }}
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ FROM python:3.12-alpine
LABEL maintainer="Salvoxia <[email protected]>"

COPY immich_auto_album.py requirements.txt docker/immich_auto_album.sh docker/setup_cron.sh /script/

RUN pip install --no-cache-dir -r /script/requirements.txt \
ARG TARGETPLATFORM
# gcc and musl-dev are required for building requirements for regex python module
RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then apk add gcc musl-dev; fi \
&& pip install --no-cache-dir -r /script/requirements.txt \
&& chmod +x /script/setup_cron.sh /script/immich_auto_album.sh \
&& rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
&& rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* \
&& if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then apk del gcc musl-dev; fi

ENV IS_DOCKER=1
WORKDIR /script
CMD ["sh", "-c", "/script/setup_cron.sh && crond -f"]

0 comments on commit ff79a45

Please sign in to comment.