From 7935733d7bbb1bcf5b0be25554a98b971554639b Mon Sep 17 00:00:00 2001 From: Brad Bayliss Date: Thu, 7 Mar 2024 15:43:03 +0000 Subject: [PATCH] Clean up Dockerfile. --- configs/core/Dockerfile | 16 ++++++---------- configs/core/start.sh | 16 ++++++---------- scripts/install-php-redis.sh | 12 ------------ 3 files changed, 12 insertions(+), 32 deletions(-) delete mode 100755 scripts/install-php-redis.sh diff --git a/configs/core/Dockerfile b/configs/core/Dockerfile index e431e34..eab0650 100644 --- a/configs/core/Dockerfile +++ b/configs/core/Dockerfile @@ -1,26 +1,22 @@ # Stage: setup-web-server FROM php:apache-buster as setup-web-server -# Install dependencies. +# Install dependencies RUN apt-get update -y && \ apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 && \ apt-get install -y libpq-dev libgmp-dev libsodium-dev libmemcached-dev zlib1g-dev wait-for-it libffi-dev golang-go && \ apt-get install -y inotify-tools libcurl4-openssl-dev libpq-dev libssl-dev supervisor dos2unix -# Install imagick +# Install imagick and redis RUN apt-get install -y libmagickwand-dev --no-install-recommends && \ - pecl install imagick + pecl install imagick redis # Install node and npm -RUN curl -sL https://deb.nodesource.com/setup_16.x -o /tmp/nodesource_setup.sh -RUN bash /tmp/nodesource_setup.sh -RUN apt-get install -y nodejs - -COPY scripts/ /usr/scripts/ +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\ + apt-get install -y nodejs +# Install and enable additional php modules RUN docker-php-ext-install ffi pdo pdo_mysql gmp bcmath sodium mysqli sockets pcntl gd - -RUN /usr/scripts/install-php-redis.sh RUN docker-php-ext-enable redis imagick # Stage: create-application diff --git a/configs/core/start.sh b/configs/core/start.sh index c0002ab..828be25 100755 --- a/configs/core/start.sh +++ b/configs/core/start.sh @@ -3,27 +3,23 @@ set -e role=${CONTAINER_ROLE:-app} +echo "Caching configuration..." +php artisan cache:clear && php artisan config:cache + if [ "$role" = "ingest" ]; then echo "Running ingest..." - php artisan cache:clear && php artisan config:cache && php artisan migrate && php artisan platform:sync && php artisan platform:ingest + php artisan migrate && php artisan platform:sync && php artisan platform:ingest elif [ "$role" = "app" ]; then - echo "Caching configuration..." - APP_KEY=$(awk '$1 ~ /^APP_KEY/' .env | cut -d "=" -f 2) - if [ -z "$APP_KEY" ]; then - php artisan key:generate - fi - php artisan log-viewer:publish && php artisan platform-ui:install --route="/" --tenant="no" --skip && php artisan cache:clear && php artisan config:cache && php artisan route:cache && php artisan view:cache + php artisan log-viewer:publish && php artisan platform-ui:install --route="/" --tenant="no" --skip && php artisan route:cache && php artisan view:cache echo "Running apache..." exec apache2-foreground elif [ "$role" = "websocket" ]; then echo "Running queue and websocket..." - chown -hR www-data:www-data /var/www/html/storage/logs || true - php artisan cache:clear && php artisan config:cache supervisord && supervisorctl start horizon php artisan websockets:serve elif [ "$role" = "beam" ]; then echo "Running beam..." - php artisan cache:clear && php artisan config:cache && php artisan platform:process-beam-claims + php artisan platform:process-beam-claims else echo "Could not match the container role \"$role\"" exit 1 diff --git a/scripts/install-php-redis.sh b/scripts/install-php-redis.sh deleted file mode 100755 index eed32ab..0000000 --- a/scripts/install-php-redis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -e - -git clone https://github.com/phpredis/phpredis.git - -cd phpredis - -phpize - -./configure - -make && make install