From 03d60438e298955254a5bf2c8d2a0e22259843f0 Mon Sep 17 00:00:00 2001 From: Joshua Boniface Date: Tue, 24 Sep 2019 23:13:40 -0400 Subject: [PATCH] Add web build to Ubuntu amd64 package build --- deployment/ubuntu-package-x64/Dockerfile | 6 ++++++ deployment/ubuntu-package-x64/docker-build.sh | 14 ++++++++++++++ deployment/ubuntu-package-x64/package.sh | 8 +++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile index 03c253e49..31164121c 100644 --- a/deployment/ubuntu-package-x64/Dockerfile +++ b/deployment/ubuntu-package-x64/Dockerfile @@ -14,6 +14,12 @@ RUN apt-get update \ && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \ && mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian +# Install yarn package manager +RUN wget -q -O- https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ + && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ + && apt update \ + && apt install -y yarn + VOLUME ${ARTIFACT_DIR}/ COPY . ${SOURCE_DIR}/ diff --git a/deployment/ubuntu-package-x64/docker-build.sh b/deployment/ubuntu-package-x64/docker-build.sh index 9781879f6..544682edf 100755 --- a/deployment/ubuntu-package-x64/docker-build.sh +++ b/deployment/ubuntu-package-x64/docker-build.sh @@ -11,6 +11,20 @@ pushd ${SOURCE_DIR} # Remove build-dep for dotnet-sdk-2.2, since it's not a package in this image sed -i '/dotnet-sdk-2.2,/d' debian/control +# Clone down and build Web frontend +web_build_dir="$( mktemp -d )" +web_target="${SOURCE_DIR}/MediaBrowser.WebDashboard/jellyfin-web" +git clone https://github.com/jellyfin/jellyfin-web.git ${web_build_dir}/ +pushd ${web_build_dir} +if [[ -n ${web_branch} ]]; then + checkout -b origin/${web_branch} +fi +yarn install +yarn build +mkdir -p ${web_target} +mv dist/* ${web_target}/ +popd + # Build DEB dpkg-buildpackage -us -uc diff --git a/deployment/ubuntu-package-x64/package.sh b/deployment/ubuntu-package-x64/package.sh index 32e6d4fd6..599336671 100755 --- a/deployment/ubuntu-package-x64/package.sh +++ b/deployment/ubuntu-package-x64/package.sh @@ -2,6 +2,12 @@ source ../common.build.sh +args="${@}" +declare -a docker_envvars +for arg in ${args}; do + docker_envvars+=("-e ${arg}") +done + WORKDIR="$( pwd )" package_temporary_dir="${WORKDIR}/pkg-dist-tmp" @@ -24,7 +30,7 @@ mkdir -p "${package_temporary_dir}" # Set up the build environment Docker image ${docker_sudo} docker build ../.. -t "${image_name}" -f ./Dockerfile # Build the DEBs and copy out to ${package_temporary_dir} -${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" +${docker_sudo} docker run --rm -v "${package_temporary_dir}:/dist" "${image_name}" ${docker_envvars} # Move the DEBs to the output directory mkdir -p "${output_dir}" mv "${package_temporary_dir}"/deb/* "${output_dir}"