Skip to content

Commit 878d8e1

Browse files
Merge pull request #48 from nyanmisaka/fix-docker-target-platform
Explicitly set the target platform of Docker builds
2 parents 543b323 + aef8d0f commit 878d8e1

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

build.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ def build_docker(
309309
DOTNET_ARCH = configurations["docker"]["archmaps"][_build_arch]["DOTNET_ARCH"]
310310
QEMU_ARCH = configurations["docker"]["archmaps"][_build_arch]["QEMU_ARCH"]
311311
IMAGE_ARCH = configurations["docker"]["archmaps"][_build_arch]["IMAGE_ARCH"]
312+
TARGET_ARCH = configurations["docker"]["archmaps"][_build_arch]["TARGET_ARCH"]
312313

313314
# Use a unique docker image name for consistency
314315
if is_stable:
@@ -327,10 +328,10 @@ def build_docker(
327328

328329
# Build the dockerfile
329330
log(
330-
f">>> {docker_build_cmd} --build-arg PACKAGE_ARCH={PACKAGE_ARCH} --build-arg DOTNET_ARCH={DOTNET_ARCH} --build-arg QEMU_ARCH={QEMU_ARCH} --build-arg IMAGE_ARCH={IMAGE_ARCH} --build-arg JELLYFIN_VERSION={jellyfin_version} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}"
331+
f">>> {docker_build_cmd} --build-arg PACKAGE_ARCH={PACKAGE_ARCH} --build-arg DOTNET_ARCH={DOTNET_ARCH} --build-arg QEMU_ARCH={QEMU_ARCH} --build-arg IMAGE_ARCH={IMAGE_ARCH} --build-arg TARGET_ARCH={TARGET_ARCH} --build-arg JELLYFIN_VERSION={jellyfin_version} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}"
331332
)
332333
ret = os.system(
333-
f"{docker_build_cmd} --build-arg PACKAGE_ARCH={PACKAGE_ARCH} --build-arg DOTNET_ARCH={DOTNET_ARCH} --build-arg QEMU_ARCH={QEMU_ARCH} --build-arg IMAGE_ARCH={IMAGE_ARCH} --build-arg JELLYFIN_VERSION={jellyfin_version} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}"
334+
f"{docker_build_cmd} --build-arg PACKAGE_ARCH={PACKAGE_ARCH} --build-arg DOTNET_ARCH={DOTNET_ARCH} --build-arg QEMU_ARCH={QEMU_ARCH} --build-arg IMAGE_ARCH={IMAGE_ARCH} --build-arg TARGET_ARCH={TARGET_ARCH} --build-arg JELLYFIN_VERSION={jellyfin_version} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}"
334335
)
335336
if ret > 0:
336337
exit(1)

build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,19 @@ docker:
100100
IMAGE_ARCH: amd64
101101
PACKAGE_ARCH: amd64
102102
QEMU_ARCH: x86_64
103+
TARGET_ARCH: amd64
103104
arm64:
104105
DOTNET_ARCH: arm64
105106
IMAGE_ARCH: arm64v8
106107
PACKAGE_ARCH: arm64
107108
QEMU_ARCH: aarch64
109+
TARGET_ARCH: arm64/v8
108110
armhf:
109111
DOTNET_ARCH: arm
110112
IMAGE_ARCH: arm32v7
111113
PACKAGE_ARCH: armhf
112114
QEMU_ARCH: arm
115+
TARGET_ARCH: arm/v7
113116
dockerfile: docker/Dockerfile
114117
imagename: jellyfin/jellyfin
115118

docker/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,10 @@ ARG PACKAGE_ARCH
2525
ARG DOTNET_ARCH
2626
# QEMU architecture (x86_64, aarch64, arm), set by build script
2727
ARG QEMU_ARCH
28-
# Base Image archiecture (amd64, arm64v8, arm32v7), set by build script
28+
# Base Image architecture (amd64, arm64v8, arm32v7), set by build script
2929
ARG IMAGE_ARCH
30+
# Target platform architecture (amd64, arm64/v8, arm/v7), set by build script
31+
ARG TARGET_ARCH
3032

3133
# Jellyfin version
3234
ARG JELLYFIN_VERSION
@@ -86,7 +88,7 @@ RUN dotnet publish Jellyfin.Server --configuration Release \
8688
# Build the final combined image
8789
#
8890
FROM multiarch/qemu-user-static:x86_64-${QEMU_ARCH} as qemu
89-
FROM ${IMAGE_ARCH}/debian:${OS_VERSION}-slim as combined
91+
FROM --platform=linux/${TARGET_ARCH} ${IMAGE_ARCH}/debian:${OS_VERSION}-slim as combined
9092

9193
ARG OS_VERSION
9294
ARG FFMPEG_PACKAGE

0 commit comments

Comments
 (0)