diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-02-16 17:03:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-02-16 17:03:15 +0100 |
| commit | bdfd042d705ec25ef37516ea7495f71eaee53d2e (patch) | |
| tree | 463809b0be8f2a8995ca7648f2425d19c3bfa8a7 /deployment/ubuntu-package-x64 | |
| parent | a6a4cd5667fbb5a793cb9e551ce9c9a9bfb0d44b (diff) | |
| parent | 25c2267a89af5c2e82774c638cdad0defcc894b5 (diff) | |
Merge branch 'master' into fields
Diffstat (limited to 'deployment/ubuntu-package-x64')
| -rw-r--r-- | deployment/ubuntu-package-x64/Dockerfile | 21 | ||||
| -rwxr-xr-x | deployment/ubuntu-package-x64/clean.sh | 29 | ||||
| -rw-r--r-- | deployment/ubuntu-package-x64/dependencies.txt | 1 | ||||
| -rwxr-xr-x | deployment/ubuntu-package-x64/docker-build.sh | 19 | ||||
| -rwxr-xr-x | deployment/ubuntu-package-x64/package.sh | 31 | ||||
| l--------- | deployment/ubuntu-package-x64/pkg-src | 1 |
6 files changed, 102 insertions, 0 deletions
diff --git a/deployment/ubuntu-package-x64/Dockerfile b/deployment/ubuntu-package-x64/Dockerfile new file mode 100644 index 000000000..485b6c42c --- /dev/null +++ b/deployment/ubuntu-package-x64/Dockerfile @@ -0,0 +1,21 @@ +FROM microsoft/dotnet:2.2-sdk-bionic +# Docker build arguments +ARG SOURCE_DIR=/jellyfin +ARG PLATFORM_DIR=/jellyfin/deployment/ubuntu-package-x64 +ARG ARTIFACT_DIR=/dist +# Docker run environment +ENV SOURCE_DIR=/jellyfin +ENV ARTIFACT_DIR=/dist +ENV DEB_BUILD_OPTIONS=noddebs + +# Prepare Ubuntu build environment +RUN apt-get update \ + && apt-get install -y apt-transport-https debhelper gnupg wget devscripts mmv libc6-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev \ + && ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh \ + && mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian + +VOLUME ${ARTIFACT_DIR}/ + +COPY . ${SOURCE_DIR}/ + +ENTRYPOINT ["/docker-build.sh"] diff --git a/deployment/ubuntu-package-x64/clean.sh b/deployment/ubuntu-package-x64/clean.sh new file mode 100755 index 000000000..c92c7fdec --- /dev/null +++ b/deployment/ubuntu-package-x64/clean.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +source ../common.build.sh + +keep_artifacts="${1}" + +WORKDIR="$( pwd )" + +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-ubuntu-build" + +rm -rf "${package_temporary_dir}" &>/dev/null \ + || sudo rm -rf "${package_temporary_dir}" &>/dev/null + +rm -rf "${output_dir}" &>/dev/null \ + || sudo rm -rf "${output_dir}" &>/dev/null + +if [[ ${keep_artifacts} == 'n' ]]; then + docker_sudo="" + if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo=sudo + fi + ${docker_sudo} docker image rm ${image_name} --force +fi diff --git a/deployment/ubuntu-package-x64/dependencies.txt b/deployment/ubuntu-package-x64/dependencies.txt new file mode 100644 index 000000000..bdb967096 --- /dev/null +++ b/deployment/ubuntu-package-x64/dependencies.txt @@ -0,0 +1 @@ +docker diff --git a/deployment/ubuntu-package-x64/docker-build.sh b/deployment/ubuntu-package-x64/docker-build.sh new file mode 100755 index 000000000..0590be097 --- /dev/null +++ b/deployment/ubuntu-package-x64/docker-build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Builds the DEB inside the Docker container + +set -o errexit +set -o xtrace + +# Move to source directory +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 + +# Build DEB +dpkg-buildpackage -us -uc + +# Move the artifacts out +mkdir -p ${ARTIFACT_DIR}/deb +mv /jellyfin_* ${ARTIFACT_DIR}/deb/ diff --git a/deployment/ubuntu-package-x64/package.sh b/deployment/ubuntu-package-x64/package.sh new file mode 100755 index 000000000..6d4625a19 --- /dev/null +++ b/deployment/ubuntu-package-x64/package.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +source ../common.build.sh + +WORKDIR="$( pwd )" + +package_temporary_dir="${WORKDIR}/pkg-dist-tmp" +output_dir="${WORKDIR}/pkg-dist" +current_user="$( whoami )" +image_name="jellyfin-ubuntu-build" + +# Determine if sudo should be used for Docker +if [[ ! -z $(id -Gn | grep -q 'docker') ]] \ + && [[ ! ${EUID:-1000} -eq 0 ]] \ + && [[ ! ${USER} == "root" ]] \ + && [[ ! -z $( echo "${OSTYPE}" | grep -q "darwin" ) ]]; then + docker_sudo="sudo" +else + docker_sudo="" +fi + +# 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}" +# Correct ownership on the DEBs (as current user, then as root if that fails) +chown -R "${current_user}" "${package_temporary_dir}" &>/dev/null \ + || sudo chown -R "${current_user}" "${package_temporary_dir}" &>/dev/null +# Move the DEBs to the output directory +mkdir -p "${output_dir}" +mv "${package_temporary_dir}"/deb/* "${output_dir}" diff --git a/deployment/ubuntu-package-x64/pkg-src b/deployment/ubuntu-package-x64/pkg-src new file mode 120000 index 000000000..4c695fea1 --- /dev/null +++ b/deployment/ubuntu-package-x64/pkg-src @@ -0,0 +1 @@ +../debian-package-x64/pkg-src
\ No newline at end of file |
