diff --git a/cache/Dockerfile b/cache/Dockerfile index 8befa063e6c57b4777d39bdd1f0f148c1b94da94..5f97dddc890bc029e33b934f0b9cb8b383233369 100644 --- a/cache/Dockerfile +++ b/cache/Dockerfile @@ -63,11 +63,17 @@ ADD configure.sh \ run-seeder.sh \ seeder.py \ mapcache-template.xml \ + entrypoint.sh \ / + RUN chmod -v +x \ /configure.sh \ /run-httpd.sh \ - /run-seeder.sh + /run-seeder.sh \ + /entrypoint.sh + +ADD mapcache.xml ${INSTALL_DIR}/ EXPOSE 80 +ENTRYPOINT ["/entrypoint.sh"] CMD ["/run-httpd.sh"] diff --git a/cache/configure.sh b/cache/configure.sh index 4e187bca4922442caf5760e727dcf1483ab79ef9..f15dba8a5361ba748b68eb6ad9b1709c51d34db1 100755 --- a/cache/configure.sh +++ b/cache/configure.sh @@ -2,6 +2,7 @@ echo "Running configure.sh" echo "Generating directory for seeding logs" +mkdir -p "${INSTALL_DIR}" mkdir -p "/cache-db/${COLLECTION}" chown -R www-data:www-data "${INSTALL_DIR}" diff --git a/cache/entrypoint.sh b/cache/entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..24f6491f2e288362a80bd8507ad09cba97b97715 --- /dev/null +++ b/cache/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash -e + +SERVICES=${WAIT_SERVICES:=''} + +if [[ ! -z $SERVICES ]] ; then + for service in $SERVICES ; do + wait-for-it $service + done +fi + +eval "$@" diff --git a/cache/install.sh b/cache/install.sh index 3bc64ae985d1df29267dc9e66d905074417732d5..9200b166d7e9b39b49b9529bf3f6c7021997df56 100755 --- a/cache/install.sh +++ b/cache/install.sh @@ -12,6 +12,6 @@ apt update echo "Installing packages" DEBIAN_FRONTEND=noninteractive apt install -y \ libmapcache1=1.8.0-1~bionic1eox2 libapache2-mod-mapcache=1.8.0-1~bionic1eox2 mapcache-tools=1.8.0-1~bionic1eox2 \ - sqlite3 curl apache2 python3-dateutil python3-redis + sqlite3 curl apache2 python3-dateutil python3-redis wait-for-it rm -rf /var/lib/apt/lists/* diff --git a/cache/run-httpd.sh b/cache/run-httpd.sh index d7e01bf7b92b92c9219dffe3cd142fc35e6112e3..0f0567a836253fbfda02e5ec5914bf8505ef7449 100755 --- a/cache/run-httpd.sh +++ b/cache/run-httpd.sh @@ -1,11 +1,7 @@ #!/bin/bash -e -/get-token-and-render.sh /configure.sh -echo "Running cron in background" -service cron start - echo "Running Apache server" rm -rf /run/apache2/* /var/run/apache2/* /tmp/apache2* exec /usr/sbin/apache2ctl -D FOREGROUND