Add similar Ubuntu build package
This commit is contained in:
parent
37985c2e26
commit
3014866f65
40
deployment/ubuntu-package-x64/Dockerfile
Normal file
40
deployment/ubuntu-package-x64/Dockerfile
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
FROM ubuntu:18.04
|
||||||
|
# Docker build arguments
|
||||||
|
ARG SOURCE_DIR=/jellyfin
|
||||||
|
ARG PLATFORM_DIR=/jellyfin/deployment/ubuntu-package-x64
|
||||||
|
ARG ARTIFACT_DIR=/dist
|
||||||
|
ARG SDK_VERSION=2.2
|
||||||
|
# Docker run environment
|
||||||
|
ENV SOURCE_DIR=/jellyfin
|
||||||
|
ENV ARTIFACT_DIR=/dist
|
||||||
|
ENV DEB_BUILD_OPTIONS=noddebs
|
||||||
|
|
||||||
|
# Prepare Debian 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
|
||||||
|
|
||||||
|
# Install dotnet repository
|
||||||
|
# https://dotnet.microsoft.com/download/linux-package-manager/debian9/sdk-current
|
||||||
|
RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.asc.gpg \
|
||||||
|
&& mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/ \
|
||||||
|
&& wget -q https://packages.microsoft.com/config/ubuntu/18.04/prod.list \
|
||||||
|
&& mv prod.list /etc/apt/sources.list.d/microsoft-prod.list \
|
||||||
|
&& chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg \
|
||||||
|
&& chown root:root /etc/apt/sources.list.d/microsoft-prod.list \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y dotnet-sdk-${SDK_VERSION}
|
||||||
|
|
||||||
|
# Link to docker-build script
|
||||||
|
RUN ln -sf ${PLATFORM_DIR}/docker-build.sh /docker-build.sh
|
||||||
|
|
||||||
|
# Link to Debian source dir; mkdir needed or it fails, can't force dest
|
||||||
|
RUN mkdir -p ${SOURCE_DIR} && ln -sf ${PLATFORM_DIR}/pkg-src ${SOURCE_DIR}/debian
|
||||||
|
|
||||||
|
# Prepare artifact volume
|
||||||
|
VOLUME ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
# Copy repository
|
||||||
|
COPY . ${SOURCE_DIR}/
|
||||||
|
|
||||||
|
# Set docker-build entrypoint
|
||||||
|
ENTRYPOINT ["/docker-build.sh"]
|
29
deployment/ubuntu-package-x64/clean.sh
Executable file
29
deployment/ubuntu-package-x64/clean.sh
Executable file
|
@ -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
|
1
deployment/ubuntu-package-x64/dependencies.txt
Normal file
1
deployment/ubuntu-package-x64/dependencies.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
docker
|
16
deployment/ubuntu-package-x64/docker-build.sh
Executable file
16
deployment/ubuntu-package-x64/docker-build.sh
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Builds the DEB inside the Docker container
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
# Move to source directory
|
||||||
|
pushd ${SOURCE_DIR}
|
||||||
|
|
||||||
|
# Build DEB
|
||||||
|
dpkg-buildpackage -us -uc
|
||||||
|
|
||||||
|
# Move the artifacts out
|
||||||
|
mkdir -p ${ARTIFACT_DIR}/deb
|
||||||
|
mv /jellyfin_* ${ARTIFACT_DIR}/deb/
|
31
deployment/ubuntu-package-x64/package.sh
Executable file
31
deployment/ubuntu-package-x64/package.sh
Executable file
|
@ -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}"
|
1
deployment/ubuntu-package-x64/pkg-src
Symbolic link
1
deployment/ubuntu-package-x64/pkg-src
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../debian-package-x64/pkg-src
|
Loading…
Reference in New Issue
Block a user