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
volumes:
- '.:/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:
image: 'nginx:alpine'
nginx:
image: 'nginx:1.23.3-alpine'
working_dir: /var/www/html
volumes:
- '.:/var/www/html'
@ -31,7 +31,7 @@ services:
- '3001:3306'
phpmyadmin:
image: phpmyadmin
image: 'phpmyadmin:5.2.0'
restart: always
ports:
- '3002:80'
@ -39,6 +39,6 @@ services:
- 'PMA_ARBITRARY=1'
mailhog:
image: 'mailhog/mailhog:latest'
image: 'mailhog/mailhog:v1.0.1'
ports:
- '3003:8025'

View File

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