From a20fc6cda67fa1eec2fe5437897434a4cf9db805 Mon Sep 17 00:00:00 2001 From: Florian Piesche Date: Sat, 3 Oct 2020 20:38:41 +0100 Subject: [PATCH] Add a Dockerfile to build a dev environment and a shell script to run a build. --- Dockerfile | 16 ++++++++++++++++ build.sh | 21 +++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Dockerfile create mode 100755 build.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..015b176 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM devkitpro/devkita64 + +# Add non-privileged build user +RUN useradd -m -s /bin/bash -G sudo build; passwd -d build + +# Install fakeroot and updated git +RUN echo "deb http://deb.debian.org/debian stretch-backports main" >> /etc/apt/sources.list.d/stretch-backports.list &&\ + apt-get update &&\ + apt-get -t stretch-backports -y install git fakeroot + +# Install devkitpro-pkgbuild-helpers +RUN dkp-pacman -S --noconfirm devkitpro-pkgbuild-helpers + +COPY build.sh /home/build/build.sh + +ENTRYPOINT ["/bin/bash"] diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..32ce533 --- /dev/null +++ b/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Exit with an error code if any of the commands fail +set -e +trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG +trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT + +# Compile and deploy custom libcurl if a PKGBUILD url is set +if [[ ! -z $LIBCURL_PKGBUILD_URL ]]; then + curdir=$(pwd) + mkdir switch-libcurl + chown ${LIBCURL_BUILD_USER} switch-libcurl + cd switch-libcurl + wget ${LIBCURL_PKGBUILD_URL} + sudo -u ${LIBCURL_BUILD_USER} dkp-makepkg + cp -r pkg/switch-curl/opt/devkitpro/portlibs/switch/* /opt/devkitpro/portlibs/switch + cd ${curdir} +fi + +# Run build +make -j NIGHTLY_BUILD=`git rev-parse --short "$GITHUB_SHA"`