From dbfe2f0f827228438bfb95a70427cc8060f1eb23 Mon Sep 17 00:00:00 2001 From: Kemal Date: Wed, 24 Jan 2024 18:37:09 +0300 Subject: [PATCH] (infra) Remove composer container and let laravel container install dependencies --- Docker/DockerfileLaravelDev | 9 ++++++--- Docker/entrypoint.sh | 13 +++++++++++++ docker-compose.yml | 8 -------- 3 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 Docker/entrypoint.sh diff --git a/Docker/DockerfileLaravelDev b/Docker/DockerfileLaravelDev index f5d290d69..d9188c6f3 100644 --- a/Docker/DockerfileLaravelDev +++ b/Docker/DockerfileLaravelDev @@ -16,7 +16,6 @@ RUN apt-get update && \ git \ zsh - # install ohmyzsh RUN chsh -s $(which zsh) RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" @@ -24,7 +23,6 @@ RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/inst # add php artisan alias RUN echo 'alias "cmd=php artisan"' >> ~/.zshrc - # remove apt lists RUN rm -rf /var/lib/apt/lists/* @@ -41,6 +39,11 @@ RUN touch /usr/local/etc/php/conf.d/xdebug.ini; \ echo xdebug.remote_log=/tmp/php5-xdebug.log >> /usr/local/etc/php/conf.d/xdebug.ini;log=/tmp/php5-xdebug.log >> /usr/local/etc/php/conf.d/xdebug.ini; COPY configuration/webserver/sites-enabled/000-default.conf /etc/apache2/sites-enabled + +COPY entrypoint.sh /usr/local/bin/ +RUN chmod +x /usr/local/bin/entrypoint.sh +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] + RUN a2enmod ssl RUN a2enmod rewrite -RUN service apache2 restart +RUN service apache2 restart \ No newline at end of file diff --git a/Docker/entrypoint.sh b/Docker/entrypoint.sh new file mode 100644 index 000000000..9d0ae6437 --- /dev/null +++ b/Docker/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/sh +cd /var/www/html/mpmanager +php composer.phar install +echo "Executing command: $@" + +# the main image's CMD arguments are somehow not passed to this script +# so we need to check if there are any arguments and if not, execute apache2-foreground which is the default CMD of the main image +if [ -z "$@" ]; then + echo "No arguments supplied, executing apache2-foreground..." + exec apache2-foreground +else + exec "$@" +fi \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 6ec1137b6..19e480730 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,14 +59,6 @@ services: - maria:db - redis:redis - composer: - container_name: mpmanager_composer - image: composer:2.6.5 - restart: "no" - command: install --ignore-platform-reqs - volumes: - - ./Website/htdocs/mpmanager:/app - 'redis': image: redis:5 volumes: