Skip to content

Commit ff79a45

Browse files
authored
Merge pull request #122 from Salvoxia/fix/dockerBuildFails
Fix/docker build fails
2 parents d225b47 + 63036ad commit ff79a45

File tree

2 files changed

+52
-3
lines changed

2 files changed

+52
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,48 @@ jobs:
2727
- name: Analysing the code with pylint
2828
run: |
2929
pylint $(git ls-files '*.py')
30+
docker:
31+
name: Build Docker Image
32+
needs: lint
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v4
37+
38+
- name: Convert repository name ot image name
39+
id: image_name
40+
run: |
41+
sed -E -e 's/docker-//' -e 's/^/image_name=/' <<<"${{ github.repository }}" >> "$GITHUB_OUTPUT"
42+
43+
- name: Generate Docker tag names
44+
id: meta
45+
uses: docker/metadata-action@v5
46+
with:
47+
# list of Docker images to use as base name for tags
48+
images: |
49+
ghcr.io/${{ steps.image_name.outputs.image_name }}
50+
${{ steps.image_name.outputs.image_name }}
51+
# generate Docker tags based on the following events/attributes
52+
tags: |
53+
# set edge tag for default branch
54+
type=edge,enable={{is_default_branch}}
55+
# set dev tag for dev branch
56+
type=raw,value=dev,enable=${{ github.ref == format('refs/heads/{0}', 'dev') }},branch=dev
57+
# Tags for non SemVer tag names
58+
type=match,pattern=([0-9]+.*),group=1
59+
# latest tag for any tags
60+
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }},event=tag
61+
62+
- name: Set up QEMU
63+
uses: docker/setup-qemu-action@v3
64+
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v3
67+
68+
- name: Build
69+
uses: docker/build-push-action@v5
70+
with:
71+
context: .
72+
platforms: linux/arm/v7,linux/arm64/v8,linux/amd64
73+
push: false
74+
tags: ${{ steps.meta.outputs.tags }}

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ FROM python:3.12-alpine
22
LABEL maintainer="Salvoxia <salvoxia@blindfish.info>"
33

44
COPY immich_auto_album.py requirements.txt docker/immich_auto_album.sh docker/setup_cron.sh /script/
5-
6-
RUN pip install --no-cache-dir -r /script/requirements.txt \
5+
ARG TARGETPLATFORM
6+
# gcc and musl-dev are required for building requirements for regex python module
7+
RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then apk add gcc musl-dev; fi \
8+
&& pip install --no-cache-dir -r /script/requirements.txt \
79
&& chmod +x /script/setup_cron.sh /script/immich_auto_album.sh \
8-
&& rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
10+
&& rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* \
11+
&& if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then apk del gcc musl-dev; fi
12+
913
ENV IS_DOCKER=1
1014
WORKDIR /script
1115
CMD ["sh", "-c", "/script/setup_cron.sh && crond -f"]

0 commit comments

Comments
 (0)