Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/docker build fails #122

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
Loading