diff options
Diffstat (limited to 'rpm/docker')
-rw-r--r-- | rpm/docker/Dockerfile | 47 | ||||
-rwxr-xr-x | rpm/docker/build.sh | 28 |
2 files changed, 75 insertions, 0 deletions
diff --git a/rpm/docker/Dockerfile b/rpm/docker/Dockerfile new file mode 100644 index 0000000..bfdd085 --- /dev/null +++ b/rpm/docker/Dockerfile @@ -0,0 +1,47 @@ +# Docker build arguments +ARG DOTNET_VERSION=8.0 +ARG NODEJS_VERSION=20 +# No GCC version choices in Fedora, sorry + +ARG PACKAGE_TYPE +ARG PACKAGE_VERSION +ARG PACKAGE_ARCH + +FROM ${PACKAGE_TYPE}:${PACKAGE_VERSION} + +ARG SOURCE_DIR=/jellyfin +ARG ARTIFACT_DIR=/dist +ARG DOTNET_VERSION +ARG NODEJS_VERSION +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=${PACKAGE_TYPE} +ENV VERSION=${PACKAGE_VERSION} +ENV ARCH=${PACKAGE_ARCH} + +# Prepare Fedora build environment +# spec file is not available during image build, so `dnf builddep jellyfin.spec` will not work here. +RUN dnf install -y \ + firewalld-filesystem \ + systemd-rpm-macros \ + dotnet-sdk-${DOTNET_VERSION} \ + npm \ + nodejs \ + rpm-build \ + && dnf clean all + +# Link to build script +RUN ln -sf ${SOURCE_DIR}/rpm/docker/build.sh /build.sh + +VOLUME ${SOURCE_DIR}/ + +VOLUME ${ARTIFACT_DIR}/ + +ENTRYPOINT ["/build.sh"] diff --git a/rpm/docker/build.sh b/rpm/docker/build.sh new file mode 100755 index 0000000..87a2bc9 --- /dev/null +++ b/rpm/docker/build.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +#= .rpm builder + +set -o errexit +set -o xtrace + +# Move to source directory +pushd "${SOURCE_DIR}" + +# Build DEB +if [[ ${ARCH} != $( uname -m ) ]]; then + #export CONFIG_SITE=/etc/dpkg-cross/cross-config.${ARCH} + export CONFIG_CROSS="-a ${ARCH}" +fi +#find . -iname 'jellyfin.spec' +#pwd +find . -maxdepth 4 -type d ! -ipath '*/node_modules/*' -exec ls -aldF --color=always {} + +mkdir -p ~/rpmbuild/RPMS ~/rpmbuild/SRPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS +tar -zcf ~/"rpmbuild/SOURCES/jellyfin-web-${JELLYFIN_VERSION}.tar.gz" jellyfin-web +tar -zcf ~/"rpmbuild/SOURCES/jellyfin-${JELLYFIN_VERSION}.tar.gz" jellyfin-server +cp -pf rpm/*.* ~/"rpmbuild/SOURCES/" +rpmbuild -ba rpm/jellyfin.spec --define="jversion ${JELLYFIN_VERSION}" + +mkdir -p "${ARTIFACT_DIR}/" +mv ~/rpmbuild/RPMS/${ARCH}/*rpm ~/rpmbuild/SRPMS/*rpm "${ARTIFACT_DIR}/" + +popd |