diff options
-rwxr-xr-x | build.py | 265 | ||||
-rw-r--r-- | debian/docker/Dockerfile | 46 | ||||
-rw-r--r-- | docker/Dockerfile | 26 | ||||
-rw-r--r-- | portable/Dockerfile | 16 | ||||
-rwxr-xr-x | portable/build.sh | 6 |
5 files changed, 188 insertions, 171 deletions
@@ -22,26 +22,26 @@ repo_root_dir = revparse.stdout.decode().strip() docker_build_cmd = "docker build --progress=plain --no-cache" docker_run_cmd = "docker run --rm" -def build_package_deb(jvers, btype, barch, bvers): +def build_package_deb(jellyfin_version, build_type, build_arch, build_version): try: - ostype = btype if btype in configurations.keys() else None - if ostype is None: - raise ValueError(f"{btype} is not a valid OS type in {configurations.keys()}") - osversion = configurations[btype]['releases'][bvers] if bvers in configurations[btype]['releases'].keys() else None - if osversion is None: - raise ValueError(f"{bvers} is not a valid {btype} version in {configurations[btype]['releases'].keys()}") - PARCH = configurations[btype]['archmaps'][barch]['PARCH'] if barch in configurations[btype]['archmaps'].keys() else None - if PARCH is None: - raise ValueError(f"{barch} is not a valid {btype} {bvers} architecture in {configurations[btype]['archmaps'].keys()}") + os_type = build_type if build_type in configurations.keys() else None + if os_type is None: + raise ValueError(f"{build_type} is not a valid OS type in {configurations.keys()}") + os_version = configurations[build_type]['releases'][build_version] if build_version in configurations[build_type]['releases'].keys() else None + if os_version is None: + raise ValueError(f"{build_version} is not a valid {build_type} version in {configurations[build_type]['releases'].keys()}") + PACKAGE_ARCH = configurations[build_type]['archmaps'][build_arch]['PACKAGE_ARCH'] if build_arch in configurations[build_type]['archmaps'].keys() else None + if PACKAGE_ARCH is None: + raise ValueError(f"{build_arch} is not a valid {build_type} {build_version} architecture in {configurations[build_type]['archmaps'].keys()}") except Exception as e: print(f"Invalid/unsupported arguments: {e}") exit(1) # Set the dockerfile - dockerfile = configurations[btype]["dockerfile"] + dockerfile = configurations[build_type]["dockerfile"] # Set the cross-gcc version - crossgccvers = configurations[btype]['cross-gcc'][bvers] + crossgccvers = configurations[build_type]['cross-gcc'][build_version] # Prepare the debian changelog file changelog_src = f"{repo_root_dir}/debian/changelog.in" @@ -50,15 +50,15 @@ def build_package_deb(jvers, btype, barch, bvers): with open(changelog_src) as fh: changelog = fh.read() - if "v" in jvers: - comment = f"Jellyfin release {jvers}, see https://github.com/jellyfin/jellyfin/releases/{jvers} for details." + if "v" in jellyfin_version: + comment = f"Jellyfin release {jellyfin_version}, see https://github.com/jellyfin/jellyfin/releases/{jellyfin_version} for details." else: - comment = f"Jellyin unstable release {jvers}." - jvers = jvers.replace('v', '') + comment = f"Jellyin unstable release {jellyfin_version}." + jellyfin_version = jellyfin_version.replace('v', '') changelog = changelog.format( - package_version=jvers, - package_build=f"{btype[:3]}{osversion.replace('.', '')}", + package_version=jellyfin_version, + package_build=f"{build_type[:3]}{os_version.replace('.', '')}", release_comment=comment, release_date=format_datetime(localtime()) ) @@ -67,113 +67,113 @@ def build_package_deb(jvers, btype, barch, bvers): fh.write(changelog) # Use a unique docker image name for consistency - imagename = f"{configurations[btype]['imagename']}-{jvers}_{barch}-{btype}-{bvers}" + imagename = f"{configurations[build_type]['imagename']}-{jellyfin_version}_{build_arch}-{build_type}-{build_version}" # Build the dockerfile and packages - os.system(f"{docker_build_cmd} --build-arg PTYPE={ostype} --build-arg PVERSION={osversion} --build-arg PARCH={PARCH} --build-arg GCC_VERSION={crossgccvers} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}") - os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --name {imagename} {imagename}") + os.system(f"{docker_build_cmd} --build-arg PACKAGE_TYPE={os_type} --build-arg PACKAGE_VERSION={os_version} --build-arg PACKAGE_ARCH={PACKAGE_ARCH} --build-arg GCC_VERSION={crossgccvers} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}") + os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{build_type}:/dist --name {imagename} {imagename}") -def build_package_rpm(jvers, btype, barch, bvers): +def build_package_rpm(jellyfin_version, build_type, build_arch, build_version): pass -def build_linux(jvers, btype, barch, _bvers): +def build_linux(jellyfin_version, build_type, build_arch, _build_version): try: - PARCH = configurations[btype]['archmaps'][barch]['PARCH'] if barch in configurations[btype]['archmaps'].keys() else None - if PARCH is None: - raise ValueError(f"{barch} is not a valid {btype} {bvers} architecture in {configurations[btype]['archmaps'].keys()}") - DARCH = configurations[btype]['archmaps'][barch]['DARCH'] + PACKAGE_ARCH = configurations[build_type]['archmaps'][build_arch]['PACKAGE_ARCH'] if build_arch in configurations[build_type]['archmaps'].keys() else None + if PACKAGE_ARCH is None: + raise ValueError(f"{build_arch} is not a valid {build_type} {build_version} architecture in {configurations[build_type]['archmaps'].keys()}") + DOTNET_ARCH = configurations[build_type]['archmaps'][build_arch]['DOTNET_ARCH'] except Exception as e: print(f"Invalid/unsupported arguments: {e}") exit(1) - jvers = jvers.replace('v', '') + jellyfin_version = jellyfin_version.replace('v', '') # Set the dockerfile - dockerfile = configurations[btype]["dockerfile"] + dockerfile = configurations[build_type]["dockerfile"] # Use a unique docker image name for consistency - imagename = f"{configurations[btype]['imagename']}-{jvers}_{barch}-{btype}" + imagename = f"{configurations[build_type]['imagename']}-{jellyfin_version}_{build_arch}-{build_type}" # Set the archive type (tar-gz or zip) - archivetypes = f"{configurations[btype]['archivetypes']}" + archivetypes = f"{configurations[build_type]['archivetypes']}" # Build the dockerfile and packages os.system(f"{docker_build_cmd} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}") - os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env BTYPE={btype} --env PARCH={PARCH} --env DTYPE=linux --env DARCH={DARCH} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}") + os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{build_type}:/dist --env JELLYFIN_VERSION={jellyfin_version} --env BUILD_TYPE={build_type} --env PACKAGE_ARCH={PACKAGE_ARCH} --env DOTNET_TYPE=linux --env DOTNET_ARCH={DOTNET_ARCH} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}") -def build_windows(jvers, btype, _barch, _bvers): +def build_windows(jellyfin_version, build_type, _build_arch, _build_version): try: - PARCH = configurations[btype]['archmaps'][barch]['PARCH'] if barch in configurations[btype]['archmaps'].keys() else None - if PARCH is None: - raise ValueError(f"{barch} is not a valid {btype} {bvers} architecture in {configurations[btype]['archmaps'].keys()}") - DARCH = configurations[btype]['archmaps'][barch]['DARCH'] + PACKAGE_ARCH = configurations[build_type]['archmaps'][build_arch]['PACKAGE_ARCH'] if build_arch in configurations[build_type]['archmaps'].keys() else None + if PACKAGE_ARCH is None: + raise ValueError(f"{build_arch} is not a valid {build_type} {build_version} architecture in {configurations[build_type]['archmaps'].keys()}") + DOTNET_ARCH = configurations[build_type]['archmaps'][build_arch]['DOTNET_ARCH'] except Exception as e: print(f"Invalid/unsupported arguments: {e}") exit(1) - jvers = jvers.replace('v', '') + jellyfin_version = jellyfin_version.replace('v', '') # Set the dockerfile - dockerfile = configurations[btype]["dockerfile"] + dockerfile = configurations[build_type]["dockerfile"] # Use a unique docker image name for consistency - imagename = f"{configurations[btype]['imagename']}-{jvers}_{barch}-{btype}" + imagename = f"{configurations[build_type]['imagename']}-{jellyfin_version}_{build_arch}-{build_type}" # Set the archive type (tar-gz or zip) - archivetypes = f"{configurations[btype]['archivetypes']}" + archivetypes = f"{configurations[build_type]['archivetypes']}" # Build the dockerfile and packages os.system(f"{docker_build_cmd} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}") - os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env BTYPE={btype} --env PARCH={PARCH} --env DTYPE=win --env DARCH={DARCH} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}") + os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{build_type}:/dist --env JELLYFIN_VERSION={jellyfin_version} --env BUILD_TYPE={build_type} --env PACKAGE_ARCH={PACKAGE_ARCH} --env DOTNET_TYPE=win --env DOTNET_ARCH={DOTNET_ARCH} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}") -def build_macos(jvers, btype, barch, _bvers): +def build_macos(jellyfin_version, build_type, build_arch, _build_version): try: - PARCH = configurations[btype]['archmaps'][barch]['PARCH'] if barch in configurations[btype]['archmaps'].keys() else None - if PARCH is None: - raise ValueError(f"{barch} is not a valid {btype} {bvers} architecture in {configurations[btype]['archmaps'].keys()}") - DARCH = configurations[btype]['archmaps'][barch]['DARCH'] + PACKAGE_ARCH = configurations[build_type]['archmaps'][build_arch]['PACKAGE_ARCH'] if build_arch in configurations[build_type]['archmaps'].keys() else None + if PACKAGE_ARCH is None: + raise ValueError(f"{build_arch} is not a valid {build_type} {build_version} architecture in {configurations[build_type]['archmaps'].keys()}") + DOTNET_ARCH = configurations[build_type]['archmaps'][build_arch]['DOTNET_ARCH'] except Exception as e: print(f"Invalid/unsupported arguments: {e}") exit(1) - jvers = jvers.replace('v', '') + jellyfin_version = jellyfin_version.replace('v', '') # Set the dockerfile - dockerfile = configurations[btype]["dockerfile"] + dockerfile = configurations[build_type]["dockerfile"] # Use a unique docker image name for consistency - imagename = f"{configurations[btype]['imagename']}-{jvers}_{barch}-{btype}" + imagename = f"{configurations[build_type]['imagename']}-{jellyfin_version}_{build_arch}-{build_type}" # Set the archive type (tar-gz or zip) - archivetypes = f"{configurations[btype]['archivetypes']}" + archivetypes = f"{configurations[build_type]['archivetypes']}" # Build the dockerfile and packages os.system(f"{docker_build_cmd} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}") - os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env BTYPE={btype} --env PARCH={PARCH} --env DTYPE=osx --env DARCH={DARCH} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}") + os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{build_type}:/dist --env JELLYFIN_VERSION={jellyfin_version} --env BUILD_TYPE={build_type} --env PACKAGE_ARCH={PACKAGE_ARCH} --env DOTNET_TYPE=osx --env DOTNET_ARCH={DOTNET_ARCH} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}") -def build_portable(jvers, btype, _barch, _bvers): - jvers = jvers.replace('v', '') +def build_portable(jellyfin_version, build_type, _build_arch, _build_version): + jellyfin_version = jellyfin_version.replace('v', '') # Set the dockerfile - dockerfile = configurations[btype]["dockerfile"] + dockerfile = configurations[build_type]["dockerfile"] # Use a unique docker image name for consistency - imagename = f"{configurations[btype]['imagename']}-{jvers}_{btype}" + imagename = f"{configurations[build_type]['imagename']}-{jellyfin_version}_{build_type}" # Set the archive type (tar-gz or zip) - archivetypes = f"{configurations[btype]['archivetypes']}" + archivetypes = f"{configurations[build_type]['archivetypes']}" # Build the dockerfile and packages os.system(f"{docker_build_cmd} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}") - os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{btype}:/dist --env JVERS={jvers} --env BTYPE={btype} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}") + os.system(f"{docker_run_cmd} --volume {repo_root_dir}:/jellyfin --volume {repo_root_dir}/out/{build_type}:/dist --env JELLYFIN_VERSION={jellyfin_version} --env BUILD_TYPE={build_type} --env ARCHIVE_TYPES={archivetypes} --name {imagename} {imagename}") -def build_docker(jvers, btype, _barch, _bvers): +def build_docker(jellyfin_version, build_type, _build_arch, _build_version): print("> Building Docker images...") print() @@ -181,60 +181,77 @@ def build_docker(jvers, btype, _barch, _bvers): architectures = configurations['docker']['archmaps'].keys() # Set the dockerfile - dockerfile = configurations[btype]["dockerfile"] + dockerfile = configurations[build_type]["dockerfile"] - # Determine if this is a "latest"-type image (v in jvers) or not - if "v" in jvers: + # Determine if this is a "latest"-type image (v in jellyfin_version) or not + if "v" in jellyfin_version: is_latest = True version_suffix = True else: is_latest = False version_suffix = False - jvers = jvers.replace('v', '') + jellyfin_version = jellyfin_version.replace('v', '') # Set today's date in a convenient format for use as an image suffix date = datetime.now().strftime("%Y%m%d-%H%M%S") images = list() - for _barch in architectures: - print(f">> Building Docker image for {_barch}...") + for _build_arch in architectures: + print(f">> Building Docker image for {_build_arch}...") print() # Get our ARCH variables from the archmaps - PARCH = configurations['docker']['archmaps'][_barch]['PARCH'] - DARCH = configurations['docker']['archmaps'][_barch]['DARCH'] - QARCH = configurations['docker']['archmaps'][_barch]['QARCH'] - BARCH = configurations['docker']['archmaps'][_barch]['BARCH'] + PACKAGE_ARCH = configurations['docker']['archmaps'][_build_arch]['PACKAGE_ARCH'] + DOTNET_ARCH = configurations['docker']['archmaps'][_build_arch]['DOTNET_ARCH'] + QEMU_ARCH = configurations['docker']['archmaps'][_build_arch]['QEMU_ARCH'] + IMAGE_ARCH = configurations['docker']['archmaps'][_build_arch]['IMAGE_ARCH'] # Use a unique docker image name for consistency if version_suffix: - imagename = f"{configurations['docker']['imagename']}:{jvers}-{_barch}.{date}" + imagename = f"{configurations['docker']['imagename']}:{jellyfin_version}-{_build_arch}.{date}" else: - imagename = f"{configurations['docker']['imagename']}:{jvers}-{_barch}" + imagename = f"{configurations['docker']['imagename']}:{jellyfin_version}-{_build_arch}" # Clean up any existing qemu static image os.system(f"{docker_run_cmd} --privileged multiarch/qemu-user-static:register --reset") print() # Build the dockerfile - os.system(f"{docker_build_cmd} --build-arg PARCH={PARCH} --build-arg DARCH={DARCH} --build-arg QARCH={QARCH} --build-arg BARCH={BARCH} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}") + os.system(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} --file {repo_root_dir}/{dockerfile} --tag {imagename} {repo_root_dir}") images.append(imagename) print() # Build the manifests print(f">> Building Docker manifests...") + manifests = list() if version_suffix: print(f">>> Building dated version manifest...") - os.system(f"docker manifest create --amend {configurations['docker']['imagename']}:{jvers}.{date} {' '.join(images)}") + os.system(f"docker manifest create --amend {configurations['docker']['imagename']}:{jellyfin_version}.{date} {' '.join(images)}") + manifests.append(f"{configurations['docker']['imagename']}:{jellyfin_version}.{date}") print(f">>> Building version manifest...") - os.system(f"docker manifest create --amend {configurations['docker']['imagename']}:{jvers} {' '.join(images)}") + os.system(f"docker manifest create --amend {configurations['docker']['imagename']}:{jellyfin_version} {' '.join(images)}") + manifests.append(f"{configurations['docker']['imagename']}:{jellyfin_version}") + if is_latest: print(f">>> Building latest manifest...") os.system(f"docker manifest create --amend {configurations['docker']['imagename']}:latest {' '.join(images)}") + manifests.append(f"{configurations['docker']['imagename']}:latest") + + # Push the images and manifests to DockerHub (we are already logged in from GH Actions) + for image in images: + os.system(f"docker push {image}") + for manifest in manifests: + os.system(f"docker manifest push --purge {manifest}") + + # Push the images and manifests to GHCR (we are already logged in from GH Actions) + for image in images: + os.system(f"docker push ghcr.io/{image}") + for manifest in manifests: + os.system(f"docker manifest push --purge ghcr.io/{manifest}") # Define a map of possible configurations @@ -245,13 +262,13 @@ configurations = { "imagename": "jellyfin-builder", "archmaps": { "amd64": { - "PARCH": "amd64", + "PACKAGE_ARCH": "amd64", }, "arm64": { - "PARCH": "arm64", + "PACKAGE_ARCH": "arm64", }, "armhf": { - "PARCH": "armhf", + "PACKAGE_ARCH": "armhf", }, }, "releases": { @@ -269,13 +286,13 @@ configurations = { "imagename": "jellyfin-builder", "archmaps": { "amd64": { - "PARCH": "amd64", + "PACKAGE_ARCH": "amd64", }, "arm64": { - "PARCH": "arm64", + "PACKAGE_ARCH": "arm64", }, "armhf": { - "PARCH": "armhf", + "PACKAGE_ARCH": "armhf", }, }, "releases": { @@ -302,24 +319,24 @@ configurations = { "archivetypes": "tar", "archmaps": { "amd64": { - "PARCH": "amd64", - "DARCH": "x64", + "PACKAGE_ARCH": "amd64", + "DOTNET_ARCH": "x64", }, "amd64-musl": { - "PARCH": "amd64-musl", - "DARCH": "musl-x64", + "PACKAGE_ARCH": "amd64-musl", + "DOTNET_ARCH": "musl-x64", }, "arm64": { - "PARCH": "arm64", - "DARCH": "arm64", + "PACKAGE_ARCH": "arm64", + "DOTNET_ARCH": "arm64", }, "arm64-musl": { - "PARCH": "arm64-musl", - "DARCH": "musl-arm64", + "PACKAGE_ARCH": "arm64-musl", + "DOTNET_ARCH": "musl-arm64", }, "armhf": { - "PARCH": "armhf", - "DARCH": "arm", + "PACKAGE_ARCH": "armhf", + "DOTNET_ARCH": "arm", }, }, }, @@ -330,12 +347,12 @@ configurations = { "archivetypes": "zip", "archmaps": { "amd64": { - "PARCH": "amd64", - "DARCH": "x64", + "PACKAGE_ARCH": "amd64", + "DOTNET_ARCH": "x64", }, "arm64": { - "PARCH": "arm64", - "DARCH": "arm64", + "PACKAGE_ARCH": "arm64", + "DOTNET_ARCH": "arm64", }, }, }, @@ -346,12 +363,12 @@ configurations = { "archivetypes": "tar", "archmaps": { "amd64": { - "PARCH": "amd64", - "DARCH": "x64", + "PACKAGE_ARCH": "amd64", + "DOTNET_ARCH": "x64", }, "arm64": { - "PARCH": "arm64", - "DARCH": "arm64", + "PACKAGE_ARCH": "arm64", + "DOTNET_ARCH": "arm64", }, }, }, @@ -367,50 +384,50 @@ configurations = { "imagename": "jellyfin/jellyfin", "archmaps": { "amd64": { - "PARCH": "amd64", - "DARCH": "x64", - "QARCH": "x86_64", - "BARCH": "amd64", + "PACKAGE_ARCH": "amd64", + "DOTNET_ARCH": "x64", + "QEMU_ARCH": "x86_64", + "IMAGE_ARCH": "amd64", }, "arm64": { - "PARCH": "arm64", - "DARCH": "arm64", - "QARCH": "aarch64", - "BARCH": "arm64v8", + "PACKAGE_ARCH": "arm64", + "DOTNET_ARCH": "arm64", + "QEMU_ARCH": "aarch64", + "IMAGE_ARCH": "arm64v8", }, "armhf": { - "PARCH": "armhf", - "DARCH": "arm", - "QARCH": "arm", - "BARCH": "arm32v7", + "PACKAGE_ARCH": "armhf", + "DOTNET_ARCH": "arm", + "QEMU_ARCH": "arm", + "IMAGE_ARCH": "arm32v7", }, } }, } def usage(): - print(f"{sys.argv[0]} JVERS BTYPE [BARCH] [BVERS]") - print(f" JVERS: The Jellyfin version being built; stable releases should be tag names with a 'v' e.g. v10.9.0") - print(f" BTYPE: A valid build OS type (debian, ubuntu, fedora, centos, docker, portable, linux, windows, macos)") - print(f" BARCH: A valid build OS CPU architecture (empty [portable/docker], amd64, arm64, or armhf)") - print(f" BVERS: A valid build OS version (packaged OS types only)") + print(f"{sys.argv[0]} JELLYFIN_VERSION BUILD_TYPE [BUILD_ARCH] [BUILD_VERSION]") + print(f" JELLYFIN_VERSION: The Jellyfin version being built; stable releases should be tag names with a 'v' e.g. v10.9.0") + print(f" BUILD_TYPE: A valid build OS type (debian, ubuntu, fedora, centos, docker, portable, linux, windows, macos)") + print(f" BUILD_ARCH: A valid build OS CPU architecture (empty [portable/docker], amd64, arm64, or armhf)") + print(f" BUILD_VERSION: A valid build OS version (packaged OS types only)") try: - jvers = sys.argv[1] - btype = sys.argv[2] + jellyfin_version = sys.argv[1] + build_type = sys.argv[2] except IndexError: usage() exit(1) try: - barch = sys.argv[3] + build_arch = sys.argv[3] except IndexError: - barch = None + build_arch = None try: - bvers = sys.argv[4] + build_version = sys.argv[4] except IndexError: - bvers = None + build_version = None -if jvers == "master": - jvers = datetime.now().strftime("%Y%m%d%H") +if jellyfin_version == "master": + jellyfin_version = datetime.now().strftime("%Y%m%d%H") -configurations[btype]['def'](jvers, btype, barch, bvers) +configurations[build_type]['def'](jellyfin_version, build_type, build_arch, build_version) diff --git a/debian/docker/Dockerfile b/debian/docker/Dockerfile index ebb6bb6..02caa7b 100644 --- a/debian/docker/Dockerfile +++ b/debian/docker/Dockerfile @@ -4,28 +4,28 @@ ARG NODEJS_VERSION=20 # Default to 12, but set externally by the `build.py` script ARG GCC_VERSION=12 -ARG PTYPE -ARG PVERSION -ARG PARCH +ARG PACKAGE_TYPE +ARG PACKAGE_VERSION +ARG PACKAGE_ARCH -FROM ${PTYPE}:${PVERSION} +FROM ${PACKAGE_TYPE}:${PACKAGE_VERSION} ARG SOURCE_DIR=/jellyfin ARG ARTIFACT_DIR=/dist ARG DOTNET_VERSION ARG NODEJS_VERSION -ARG PTYPE -ARG PVERSION -ARG PARCH +ARG PACKAGE_TYPE +ARG PACKAGE_VERSION +ARG PACKAGE_ARCH ARG GCC_VERSION # Docker run environment ENV SOURCE_DIR=/jellyfin ENV ARTIFACT_DIR=/dist ENV DEB_BUILD_OPTIONS=noddebs -ENV TYPE=${PTYPE} -ENV VERSION=${PVERSION} -ENV ARCH=${PARCH} +ENV TYPE=${PACKAGE_TYPE} +ENV VERSION=${PACKAGE_VERSION} +ENV ARCH=${PACKAGE_ARCH} # Prepare Debian build environment RUN apt-get update -y \ @@ -39,7 +39,7 @@ RUN apt-get update -y \ && rm -rf /var/lib/apt/lists/* # Prepare the cross-toolchain -RUN if test "${PARCH}" != "$( dpkg --print-architecture )"; then \ +RUN if test "${PACKAGE_ARCH}" != "$( dpkg --print-architecture )"; then \ if grep -q -i ubuntu /etc/os-release; then \ rm /etc/apt/sources.list \ && export CODENAME="$( lsb_release -c -s )" \ @@ -47,33 +47,33 @@ RUN if test "${PARCH}" != "$( dpkg --print-architecture )"; then \ && echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${CODENAME}-updates main restricted universe multiverse" >>/etc/apt/sources.list.d/amd64.list \ && echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${CODENAME}-backports main restricted universe multiverse" >>/etc/apt/sources.list.d/amd64.list \ && echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${CODENAME}-security main restricted universe multiverse" >>/etc/apt/sources.list.d/amd64.list \ - && echo "deb [arch=${PARCH}] http://ports.ubuntu.com/ ${CODENAME} main restricted universe multiverse" >>/etc/apt/sources.list.d/${PARCH}.list \ - && echo "deb [arch=${PARCH}] http://ports.ubuntu.com/ ${CODENAME}-updates main restricted universe multiverse" >>/etc/apt/sources.list.d/${PARCH}.list \ - && echo "deb [arch=${PARCH}] http://ports.ubuntu.com/ ${CODENAME}-backports main restricted universe multiverse" >>/etc/apt/sources.list.d/${PARCH}.list \ - && echo "deb [arch=${PARCH}] http://ports.ubuntu.com/ ${CODENAME}-security main restricted universe multiverse" >>/etc/apt/sources.list.d/${PARCH}.list \ + && echo "deb [arch=${PACKAGE_ARCH}] http://ports.ubuntu.com/ ${CODENAME} main restricted universe multiverse" >>/etc/apt/sources.list.d/${PACKAGE_ARCH}.list \ + && echo "deb [arch=${PACKAGE_ARCH}] http://ports.ubuntu.com/ ${CODENAME}-updates main restricted universe multiverse" >>/etc/apt/sources.list.d/${PACKAGE_ARCH}.list \ + && echo "deb [arch=${PACKAGE_ARCH}] http://ports.ubuntu.com/ ${CODENAME}-backports main restricted universe multiverse" >>/etc/apt/sources.list.d/${PACKAGE_ARCH}.list \ + && echo "deb [arch=${PACKAGE_ARCH}] http://ports.ubuntu.com/ ${CODENAME}-security main restricted universe multiverse" >>/etc/apt/sources.list.d/${PACKAGE_ARCH}.list \ ; fi \ && set -o xtrace \ - && dpkg --add-architecture ${PARCH} \ + && dpkg --add-architecture ${PACKAGE_ARCH} \ && apt-get update -y \ && apt-get install --no-install-recommends -y cross-gcc-dev \ - && TARGET_LIST="${PARCH}" cross-gcc-gensource ${GCC_VERSION} \ - && cd cross-gcc-packages-amd64/cross-gcc-${GCC_VERSION}-${PARCH} \ + && TARGET_LIST="${PACKAGE_ARCH}" cross-gcc-gensource ${GCC_VERSION} \ + && cd cross-gcc-packages-amd64/cross-gcc-${GCC_VERSION}-${PACKAGE_ARCH} \ && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \ apt-get -f install --no-install-recommends -o Dpkg::Options::="--force-overwrite" -y \ bison flex libtool gdb sharutils netbase libmpc-dev libmpfr-dev libgmp-dev \ systemtap-sdt-dev autogen expect chrpath zlib1g-dev zip \ binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf \ - gcc-${GCC_VERSION}-source libstdc++-${GCC_VERSION}-dev-${PARCH}-cross \ - libc6-dev:${PARCH} linux-libc-dev:${PARCH} libgcc1:${PARCH} libstdc++-${GCC_VERSION}-dev:${PARCH} \ - libfontconfig*-dev:${PARCH} libcurl*openssl-dev:${PARCH} libfreetype*-dev:${PARCH} libssl-dev:${PARCH} \ - libssl[13].*:${PARCH} liblttng-ust*:${PARCH} \ + gcc-${GCC_VERSION}-source libstdc++-${GCC_VERSION}-dev-${PACKAGE_ARCH}-cross \ + libc6-dev:${PACKAGE_ARCH} linux-libc-dev:${PACKAGE_ARCH} libgcc1:${PACKAGE_ARCH} libstdc++-${GCC_VERSION}-dev:${PACKAGE_ARCH} \ + libfontconfig*-dev:${PACKAGE_ARCH} libcurl*openssl-dev:${PACKAGE_ARCH} libfreetype*-dev:${PACKAGE_ARCH} libssl-dev:${PACKAGE_ARCH} \ + libssl[13].*:${PACKAGE_ARCH} liblttng-ust*:${PACKAGE_ARCH} \ && apt-get clean autoclean -y \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* \ ; fi # Prepare dotnet SDK -RUN wget https://packages.microsoft.com/config/${PTYPE}/${PVERSION}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ +RUN wget https://packages.microsoft.com/config/${PACKAGE_TYPE}/${PACKAGE_VERSION}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ && dpkg -i packages-microsoft-prod.deb \ && apt-get -f install \ && apt-get update \ diff --git a/docker/Dockerfile b/docker/Dockerfile index f050fde..705935f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,13 +15,13 @@ ARG NEO_VERSION=23.30.26918.9 ARG LEVEL_ZERO_VERSION=1.3.26918.9 # Debian architecture (amd64, arm64, armhf), set by build script -ARG PARCH +ARG PACKAGE_ARCH # Dotnet architeture (x64, arm64, arm), set by build script -ARG DARCH +ARG DOTNET_ARCH # QEMU architecture (x86_64, aarch64, arm), set by build script -ARG QARCH +ARG QEMU_ARCH # Base Image archiecture (amd64, arm64v8, arm32v7), set by build script -ARG BARCH +ARG IMAGE_ARCH # # Build the web artifacts @@ -58,7 +58,7 @@ RUN npm ci --no-audit --unsafe-perm \ # FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-${OS_VERSION}-slim as server -ARG DARCH +ARG DOTNET_ARCH ARG SOURCE_DIR=/src ARG ARTIFACT_DIR=/server @@ -69,13 +69,13 @@ ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 RUN dotnet publish Jellyfin.Server --configuration Release \ --output="${ARTIFACT_DIR}" --self-contained \ - --runtime linux-${DARCH} -p:DebugSymbols=false -p:DebugType=none + --runtime linux-${DOTNET_ARCH} -p:DebugSymbols=false -p:DebugType=none # # Build the final combined image # -FROM multiarch/qemu-user-static:x86_64-${QARCH} as qemu -FROM ${BARCH}/debian:${OS_VERSION}-slim as combined +FROM multiarch/qemu-user-static:x86_64-${QEMU_ARCH} as qemu +FROM ${IMAGE_ARCH}/debian:${OS_VERSION}-slim as combined ARG OS_VERSION ARG FFMPEG_PACKAGE @@ -85,9 +85,9 @@ ARG IGC_VERSION ARG NEO_VERSION ARG LEVEL_ZERO_VERSION -ARG PARCH -ARG DARCH -ARG QARCH +ARG PACKAGE_ARCH +ARG DOTNET_ARCH +ARG QEMU_ARCH # Copy the QEMU runtime COPY --from=qemu /usr/bin/* /usr/bin @@ -126,7 +126,7 @@ RUN apt-get update \ apt-transport-https \ && curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key \ | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian-jellyfin.gpg \ - && echo "deb [arch=${PARCH}] https://repo.jellyfin.org/debian ${OS_VERSION} main" > /etc/apt/sources.list.d/jellyfin.list \ + && echo "deb [arch=${PACKAGE_ARCH}] https://repo.jellyfin.org/debian ${OS_VERSION} main" > /etc/apt/sources.list.d/jellyfin.list \ && apt-get update \ && apt-get install --no-install-recommends --no-install-suggests --yes \ ${FFMPEG_PACKAGE} \ @@ -144,7 +144,7 @@ RUN apt-get update \ # Prefer NEO to Beignet since the latter one doesn't support Comet Lake or newer for now. # Do not use the intel-opencl-icd package from repo since they will not build with RELEASE_WITH_REGKEYS enabled. # https://github.com/intel/compute-runtime/releases -RUN if [[ ${PARCH} == "amd64" ]]; then \ +RUN if [[ ${PACKAGE_ARCH} == "amd64" ]]; then \ mkdir intel-compute-runtime \ && pushd intel-compute-runtime \ && wget https://github.com/intel/compute-runtime/releases/download/${NEO_VERSION}/libigdgmm12_${GMMLIB_VERSION}_amd64.deb \ diff --git a/portable/Dockerfile b/portable/Dockerfile index 3f86299..096192a 100644 --- a/portable/Dockerfile +++ b/portable/Dockerfile @@ -2,23 +2,23 @@ ARG DOTNET_VERSION=8.0 ARG NODEJS_VERSION=20 -ARG PTYPE=debian -ARG PVERSION=12 +ARG PACKAGE_TYPE=debian +ARG PACKAGE_VERSION=12 -FROM ${PTYPE}:${PVERSION} +FROM ${PACKAGE_TYPE}:${PACKAGE_VERSION} ARG SOURCE_DIR=/jellyfin ARG ARTIFACT_DIR=/dist ARG DOTNET_VERSION ARG NODEJS_VERSION -ARG PTYPE -ARG PVERSION +ARG PACKAGE_TYPE +ARG PACKAGE_VERSION # Docker run environment ENV SOURCE_DIR=/jellyfin ENV ARTIFACT_DIR=/dist -ENV TYPE=${PTYPE} -ENV VERSION=${PVERSION} +ENV TYPE=${PACKAGE_TYPE} +ENV VERSION=${PACKAGE_VERSION} ENV ARCHIVE_TYPES=tar # Prepare Debian build environment @@ -33,7 +33,7 @@ RUN apt-get update -y \ && rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* # Prepare dotnet SDK -RUN wget https://packages.microsoft.com/config/${PTYPE}/${PVERSION}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ +RUN wget https://packages.microsoft.com/config/${PACKAGE_TYPE}/${PACKAGE_VERSION}/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ && dpkg -i packages-microsoft-prod.deb \ && apt-get -f install \ && apt-get update \ diff --git a/portable/build.sh b/portable/build.sh index b8bb2ce..c979805 100755 --- a/portable/build.sh +++ b/portable/build.sh @@ -20,7 +20,7 @@ case ${BTYPE} in APPHOST="-p:UseAppHost=false" ;; *) - RUNTIME="--self-contained --runtime ${DTYPE}-${DARCH}" + RUNTIME="--self-contained --runtime ${DOTNET_TYPE}-${DOTNET_ARCH}" APPHOST="-p:UseAppHost=true" ;; esac @@ -36,8 +36,8 @@ popd mkdir -p "${ARTIFACT_DIR}/" -if [[ -n ${PARCH} ]]; then - VERSION_SUFFIX="${JVERS}-${PARCH}" +if [[ -n ${PACKAGE_ARCH} ]]; then + VERSION_SUFFIX="${JVERS}-${PACKAGE_ARCH}" else VERSION_SUFFIX="${JVERS}" fi |