Use the official php:8.0-alpine package and perform a composer and NPM installation every time the containers get started

This commit is contained in:
Alex Tselegidis 2023-01-21 12:41:05 +01:00
parent 26dea7bcb6
commit 7d26f8d0c5
3 changed files with 35 additions and 17 deletions

View file

@ -7,10 +7,10 @@ services:
- host.docker.internal:host-gateway - host.docker.internal:host-gateway
volumes: volumes:
- '.:/var/www/html' - '.:/var/www/html'
- './docker/php-fpm/php-ini-overrides.ini:/etc/php/8.0/fpm/conf.d/99-overrides.ini' - './docker/php-fpm/php-ini-overrides.ini:/usr/local/etc/php/conf.d/99-overrides.ini'
webserver: nginx:
image: 'nginx:alpine' image: 'nginx:1.23.3-alpine'
working_dir: /var/www/html working_dir: /var/www/html
volumes: volumes:
- '.:/var/www/html' - '.:/var/www/html'
@ -31,7 +31,7 @@ services:
- '3001:3306' - '3001:3306'
phpmyadmin: phpmyadmin:
image: phpmyadmin image: 'phpmyadmin:5.2.0'
restart: always restart: always
ports: ports:
- '3002:80' - '3002:80'
@ -39,6 +39,6 @@ services:
- 'PMA_ARBITRARY=1' - 'PMA_ARBITRARY=1'
mailhog: mailhog:
image: 'mailhog/mailhog:latest' image: 'mailhog/mailhog:v1.0.1'
ports: ports:
- '3003:8025' - '3003:8025'

View file

@ -1,15 +1,20 @@
FROM phpdockerio/php:8.0-fpm FROM php:8.0-fpm
WORKDIR "/var/www/html" WORKDIR "/var/www/html"
RUN apt-get update; \ RUN apt-get update \
apt-get -y --no-install-recommends install \ && apt-get install -y \
git \ git \
php8.0-gd \ zip \
php8.0-intl \ unzip \
php8.0-ldap \ && curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s \
php8.0-mcrypt \ curl gd intl ldap mbstring mysqli odbc pdo soap sockets xml zip xdebug \
php8.0-mysql \ && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
php8.0-soap \ && curl -sLS https://deb.nodesource.com/setup_18.x | bash - \
php8.0-xdebug; \ && apt-get install -y nodejs \
apt-get clean; \ && npm install -g npm \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* && apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
CMD ["bash", "docker/php-fpm/start-container"]

View file

@ -0,0 +1,13 @@
#!/bin/bash
echo "➜ Install Composer Dependencies"
composer install
echo "➜ Install NPM Dependencies"
npm install
echo "➜ Build Project Assets"
gulp build
echo "➜ Listen To Incoming Requests"
php-fpm