Add a Dockerfile to build a dev environment and a shell script to run a build.

This commit is contained in:
Florian Piesche 2020-10-03 20:38:41 +01:00
parent afd9495f31
commit a20fc6cda6
2 changed files with 37 additions and 0 deletions

16
Dockerfile Normal file
View file

@ -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"]

21
build.sh Executable file
View file

@ -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"`