Skip to content

Commit

Permalink
Merge pull request #81 from EmakinaFR/feature/php
Browse files Browse the repository at this point in the history
  • Loading branch information
duboiss committed Mar 25, 2022
2 parents 7672f46 + 94e3fe1 commit c9ba6cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 99 deletions.
8 changes: 5 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.7"
version: "3.8"

services:
blackfire:
Expand Down Expand Up @@ -68,13 +68,15 @@ services:
context: ./php
target: ${DOCKER_PHP_IMAGE}
env_file: ${PROJECT_LOCATION}/docker/local/.env
environment:
- SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
volumes:
# Projects files
- code_sync:/var/www/html:nocopy
# Custom configuration
- ./php/conf.d/custom.ini:/usr/local/etc/php/conf.d/custom.ini:ro
# SSH keys
- ~/.ssh:/root/.ssh:ro
# SSH socket
- /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock
depends_on:
- mysql
- redis
Expand Down
104 changes: 8 additions & 96 deletions php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,102 +1,14 @@
FROM php:7.4-fpm-alpine as proximis_php
FROM ajardin/php:7.4 as proximis_php

LABEL maintainer="EmakinaFR <team-proximis@emakina.fr>"

# Install Proximis requirements
RUN \
apk add --no-cache \
autoconf \
automake \
curl \
freetype-dev \
gcc \
g++ \
git \
icu-dev \
icu-libs \
imagemagick-dev \
jq \
libtool \
libjpeg-turbo-dev \
libmcrypt-dev \
libpng-dev \
libssh2-dev \
libxml2-dev \
libxml2-utils \
libxslt-dev \
libwebp-dev \
libzip-dev \
make \
msmtp \
ncurses \
npm \
openssh-client \
patch \
perl \
shadow \
ssmtp \
yarn && \
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \
docker-php-ext-configure bcmath && \
docker-php-ext-configure gd \
--with-freetype \
--with-jpeg \
--with-webp && \
docker-php-ext-install -j$(nproc) \
bcmath \
gd \
intl \
opcache \
pdo_mysql \
soap \
xml \
xsl \
zip && \
yes "" | pecl install apcu igbinary imagick redis ssh2-1.2 && \
docker-php-ext-enable apcu igbinary imagick redis ssh2 && \
perl -pi -e "s/mailhub=mail/mailhub=maildev/" /etc/ssmtp/ssmtp.conf && \
perl -pi -e "s|;pm.status_path = /status|pm.status_path = /php_fpm_status|g" /usr/local/etc/php-fpm.d/www.conf && \
yarn global add grunt-cli && \
apk del .build-deps

# Install Composer globally
ENV COMPOSER_ALLOW_SUPERUSER 1
RUN \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ENV PATH "${PATH}:/root/.composer/vendor/bin"

# Automatically start the SSH agent when a new session is created
RUN echo 'eval $(ssh-agent) && ssh-add' >> /home/www-data/.profile

RUN \
usermod -u 1000 www-data && \
groupmod -g 1000 www-data

# Install custom entrypoint
COPY entrypoint.sh /usr/local/bin/docker-custom-entrypoint
RUN chmod 777 /usr/local/bin/docker-custom-entrypoint
CMD ["php-fpm"]
ENTRYPOINT ["docker-custom-entrypoint"]
apk add --no-cache autoconf g++ gcc imagemagick-dev ncurses && \
pecl install igbinary imagick && \
docker-php-ext-enable igbinary imagick

# ========================================
FROM ajardin/php:7.4-blackfire as proximis_php_blackfire
FROM ajardin/php:7.4-xdebug as proximis_php_xdebug

RUN \
version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") && \
architecture=$(case $(uname -m) in i386 | i686 | x86) echo "i386" ;; x86_64 | amd64) echo "amd64" ;; aarch64 | arm64 | armv8) echo "arm64" ;; *) echo "amd64" ;; esac) && \
curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s "https://blackfire.io/api/v1/releases/probe/php/alpine/${architecture}/${version}" && \
mkdir -p /tmp/blackfire && \
tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire && \
mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so && \
rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz && \
docker-php-ext-enable blackfire
# ========================================

# ========================================
FROM proximis_php as proximis_php_xdebug

RUN \
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS && \
yes "" | pecl install xdebug && \
docker-php-ext-enable xdebug
# ========================================
apk add --no-cache autoconf g++ gcc imagemagick-dev ncurses && \
pecl install igbinary imagick && \
docker-php-ext-enable igbinary imagick

0 comments on commit c9ba6cf

Please sign in to comment.