From f79335ff1aace4c78b536dcd1c15b2de53fc734f Mon Sep 17 00:00:00 2001 From: Jacob Alberty Date: Wed, 14 Oct 2020 20:38:59 -0500 Subject: [PATCH] Add pre_build dependency system to move towards #360 --- Dockerfile | 7 +++++-- docker-build.sh | 5 +++++ pre_build/README.md | 5 +++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 pre_build/README.md diff --git a/Dockerfile b/Dockerfile index 5382e2b9..ab3d6ff9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,16 +58,19 @@ RUN set -ex \ RUN mkdir -p /usr/unifi \ /usr/local/unifi/init.d \ - /usr/unifi/init.d + /usr/unifi/init.d \ + /usr/local/docker COPY docker-entrypoint.sh /usr/local/bin/ COPY docker-healthcheck.sh /usr/local/bin/ COPY docker-build.sh /usr/local/bin/ COPY functions /usr/unifi/functions COPY import_cert /usr/unifi/init.d/ +COPY pre_build /usr/local/docker/pre_build RUN chmod +x /usr/local/bin/docker-entrypoint.sh \ && chmod +x /usr/unifi/init.d/import_cert \ && chmod +x /usr/local/bin/docker-healthcheck.sh \ - && chmod +x /usr/local/bin/docker-build.sh + && chmod +x /usr/local/bin/docker-build.sh \ + && chmod -R +x /usr/local/docker/pre_build # Push installing openjdk-8-jre first, so that the unifi package doesn't pull in openjdk-7-jre as a dependency? Else uncomment and just go with openjdk-7. RUN set -ex \ diff --git a/docker-build.sh b/docker-build.sh index 5f72a5a5..98db6ce9 100755 --- a/docker-build.sh +++ b/docker-build.sh @@ -44,6 +44,11 @@ echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb apt-get update echo "deb http://www.ubnt.com/downloads/unifi/debian unifi5 ubiquiti" > /etc/apt/sources.list.d/20ubiquiti.list tryfail apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 06E85760C0A52C50 + +if [ -d "/usr/local/docker/pre_build/$(dpkg --print-architecture)" ]; then + find "/usr/local/docker/pre_build/$(dpkg --print-architecture)" -type f -exec '{}' \; +fi + curl -L -o ./unifi.deb "${1}" apt -qy install mongodb-org ./unifi.deb rm -f ./unifi.deb diff --git a/pre_build/README.md b/pre_build/README.md new file mode 100644 index 00000000..2cfa4e84 --- /dev/null +++ b/pre_build/README.md @@ -0,0 +1,5 @@ +This folder is for adding build scripts for various architectures to apply quick fixes for building on other architectures. + +To use you would create a subfolder (ie `armhf`, `amd64`, `arm64`) then place an appropriate shell script in that folder to build. + +This directory was added to enable satisfying dependencies that aren't automatically satisfied by the distro (for ex: mongodb on armhf)