diff --git a/openshift/drupal-repository/Dockerfile b/openshift/drupal-repository/Dockerfile index df74e63..eab6a17 100644 --- a/openshift/drupal-repository/Dockerfile +++ b/openshift/drupal-repository/Dockerfile @@ -1,14 +1,8 @@ FROM alpine:3.19 COPY --from=almir/webhook /usr/local/bin/webhook /usr/local/bin/webhook -ARG S6_OVERLAY_VERSION=3.1.6.2 -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz -ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp -RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz - # We need php and git to build satis. -RUN apk add --no-cache git php82 php82-openssl php82-common php82-json php82-phar php82-mbstring php82-pecl-apcu php82-zip php82-simplexml make +RUN apk add --no-cache git php82 php82-openssl php82-common php82-json php82-phar php82-mbstring php82-pecl-apcu php82-zip php82-simplexml make tini ENV COMPOSER_HOME=/.composer ENV PROJECT_DIR=/var/www/html @@ -24,4 +18,9 @@ EXPOSE 9000 # Copy configuration files and scripts COPY files/ / -ENTRYPOINT ["/init"] +RUN chmod +x /entrypoints/* && \ + chmod +x /usr/local/bin/entrypoint +ENTRYPOINT ["/sbin/tini", "--"] + +# Default command: Start up multiple services via entrypoint +CMD ["entrypoint"] diff --git a/openshift/drupal-repository/files/entrypoints/10-queue.sh b/openshift/drupal-repository/files/entrypoints/10-queue.sh new file mode 100644 index 0000000..0e23ab5 --- /dev/null +++ b/openshift/drupal-repository/files/entrypoints/10-queue.sh @@ -0,0 +1,9 @@ +#!/bin/sh +cd $PROJECT_DIR +make + +(while true +do + php console.php queue:consume package-queue --item-limit 10 +done) & + diff --git a/openshift/drupal-repository/files/entrypoints/99-webhook.sh b/openshift/drupal-repository/files/entrypoints/99-webhook.sh new file mode 100644 index 0000000..e04d5ca --- /dev/null +++ b/openshift/drupal-repository/files/entrypoints/99-webhook.sh @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/local/bin/webhook -verbose -hooks=/etc/webhook/hooks.json -template -hotreload -debug diff --git a/openshift/drupal-repository/files/usr/local/bin/entrypoint b/openshift/drupal-repository/files/usr/local/bin/entrypoint new file mode 100644 index 0000000..93e4217 --- /dev/null +++ b/openshift/drupal-repository/files/usr/local/bin/entrypoint @@ -0,0 +1,19 @@ +#!/bin/sh + +# This script will be the default ENTRYPOINT for all children docker images. +# It just sources all files within /entrypoints/* in an alphabetical order and then runs `exec` on the given parameter. + +if [ -d /entrypoints ]; then + for i in /entrypoints/*; do + if [ -r $i ]; then + echo "# Source $i" + . $i + else + echo "! $i not sourced" + fi + done + unset i +fi + +echo "Exec: $@" +exec "$@"