Browse Source

Update Docker setup

Julien Falque 3 years ago
parent
commit
92cd374585

+ 3 - 3
docker-compose.override.yaml.dist

@@ -1,7 +1,7 @@
 version: '3.8'
 
 services:
-  php-7.1: &php
+  php-7.2: &php
     build:
       args:
         DOCKER_USER_ID: 1000 # replace with your user id (most likely 1000)
@@ -11,11 +11,11 @@ services:
       # Required for Docker Linux until natively supported.
       # See https://github.com/docker/for-linux/issues/264
       host.docker.internal: 172.17.0.1
-  php-7.2:
-    <<: *php
   php-7.3:
     <<: *php
   php-7.4:
     <<: *php
   php-8.0:
     <<: *php
+  php-8.1:
+    <<: *php

+ 5 - 5
docker-compose.yaml

@@ -1,17 +1,14 @@
 version: '3.8'
 
 services:
-  php-7.1: &php
-    build: docker/php-7.1
+  php-7.2: &php
+    build: docker/php-7.2
     working_dir: /app
     volumes:
       - .:/app
     environment:
       PHP_IDE_CONFIG: serverName=php-cs-fixer
       PHP_CS_FIXER_ALLOW_XDEBUG: 1
-  php-7.2:
-    <<: *php
-    build: docker/php-7.2
   php-7.3:
     <<: *php
     build: docker/php-7.3
@@ -21,3 +18,6 @@ services:
   php-8.0:
     <<: *php
     build: docker/php-8.0
+  php-8.1:
+    <<: *php
+    build: docker/php-8.1

+ 0 - 5
docker/php-7.1/xdebug.ini

@@ -1,5 +0,0 @@
-;zend_extension=xdebug.so
-xdebug.remote_autostart=1
-xdebug.remote_enable=1
-xdebug.remote_host=host.docker.internal
-xdebug.remote_port=9003

+ 7 - 8
docker/php-7.2/Dockerfile

@@ -9,19 +9,18 @@ RUN if ! getent group "${DOCKER_GROUP_ID}" > /dev/null; \
   && if ! getent passwd "${DOCKER_USER_ID}" > /dev/null; \
     then adduser -S -u "${DOCKER_USER_ID}" -G "$(getent group "${DOCKER_GROUP_ID}" | awk -F: '{printf $1}')" dev; \
   fi \
-  && apk add --no-cache git libxml2-dev openssh-client \
-  && apk add --no-cache --virtual .build-deps autoconf g++ make \
-  # xdebug
-  && pecl install xdebug-2.9.8 \
-  && docker-php-ext-enable xdebug \
+  # php extensions
+  && curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
+  && chmod +x /usr/local/bin/install-php-extensions \
+  && sync \
+  && install-php-extensions \
+    xdebug-3.1.2 \
   # composer
   && curl --output composer-setup.php https://getcomposer.org/installer \
   && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
   && rm composer-setup.php \
   # xdebug command
   && curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v2.0.0/xdebug \
-  && chmod +x /usr/local/bin/xdebug \
-  # clean up
-  && apk del .build-deps
+  && chmod +x /usr/local/bin/xdebug
 
 COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

+ 3 - 4
docker/php-7.2/xdebug.ini

@@ -1,5 +1,4 @@
 ;zend_extension=xdebug.so
-xdebug.remote_autostart=1
-xdebug.remote_enable=1
-xdebug.remote_host=host.docker.internal
-xdebug.remote_port=9003
+xdebug.client_host=host.docker.internal
+xdebug.mode=debug
+xdebug.start_with_request=yes

+ 8 - 9
docker/php-7.3/Dockerfile

@@ -1,4 +1,4 @@
-FROM php:7.3-cli-alpine3.13
+FROM php:7.3-cli-alpine3.15
 
 ARG DOCKER_USER_ID
 ARG DOCKER_GROUP_ID
@@ -9,19 +9,18 @@ RUN if ! getent group "${DOCKER_GROUP_ID}" > /dev/null; \
   && if ! getent passwd "${DOCKER_USER_ID}" > /dev/null; \
     then adduser -S -u "${DOCKER_USER_ID}" -G "$(getent group "${DOCKER_GROUP_ID}" | awk -F: '{printf $1}')" dev; \
   fi \
-  && apk add --no-cache git libxml2-dev openssh-client \
-  && apk add --no-cache --virtual .build-deps autoconf g++ make \
-  # xdebug
-  && pecl install xdebug-3.0.1 \
-  && docker-php-ext-enable xdebug \
+  # php extensions
+  && curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
+  && chmod +x /usr/local/bin/install-php-extensions \
+  && sync \
+  && install-php-extensions \
+    xdebug-3.1.2 \
   # composer
   && curl --output composer-setup.php https://getcomposer.org/installer \
   && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
   && rm composer-setup.php \
   # xdebug command
   && curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v2.0.0/xdebug \
-  && chmod +x /usr/local/bin/xdebug \
-  # clean up
-  && apk del .build-deps
+  && chmod +x /usr/local/bin/xdebug
 
 COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

+ 8 - 9
docker/php-7.4/Dockerfile

@@ -1,4 +1,4 @@
-FROM php:7.4-cli-alpine3.13
+FROM php:7.4-cli-alpine3.15
 
 ARG DOCKER_USER_ID
 ARG DOCKER_GROUP_ID
@@ -9,19 +9,18 @@ RUN if ! getent group "${DOCKER_GROUP_ID}" > /dev/null; \
   && if ! getent passwd "${DOCKER_USER_ID}" > /dev/null; \
     then adduser -S -u "${DOCKER_USER_ID}" -G "$(getent group "${DOCKER_GROUP_ID}" | awk -F: '{printf $1}')" dev; \
   fi \
-  && apk add --no-cache git libxml2-dev openssh-client \
-  && apk add --no-cache --virtual .build-deps autoconf g++ make \
-  # xdebug
-  && pecl install xdebug-3.0.1 \
-  && docker-php-ext-enable xdebug \
+  # php extensions
+  && curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
+  && chmod +x /usr/local/bin/install-php-extensions \
+  && sync \
+  && install-php-extensions \
+    xdebug-3.1.2 \
   # composer
   && curl --output composer-setup.php https://getcomposer.org/installer \
   && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
   && rm composer-setup.php \
   # xdebug command
   && curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v2.0.0/xdebug \
-  && chmod +x /usr/local/bin/xdebug \
-  # clean up
-  && apk del .build-deps
+  && chmod +x /usr/local/bin/xdebug
 
 COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

+ 8 - 9
docker/php-8.0/Dockerfile

@@ -1,4 +1,4 @@
-FROM php:8.0-cli-alpine3.13
+FROM php:8.0-cli-alpine3.15
 
 ARG DOCKER_USER_ID
 ARG DOCKER_GROUP_ID
@@ -9,19 +9,18 @@ RUN if ! getent group "${DOCKER_GROUP_ID}" > /dev/null; \
   && if ! getent passwd "${DOCKER_USER_ID}" > /dev/null; \
     then adduser -S -u "${DOCKER_USER_ID}" -G "$(getent group "${DOCKER_GROUP_ID}" | awk -F: '{printf $1}')" dev; \
   fi \
-  && apk add --no-cache git libxml2-dev openssh-client \
-  && apk add --no-cache --virtual .build-deps autoconf g++ make \
-  # xdebug
-  && pecl install xdebug-3.0.1 \
-  && docker-php-ext-enable xdebug \
+  # php extensions
+  && curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
+  && chmod +x /usr/local/bin/install-php-extensions \
+  && sync \
+  && install-php-extensions \
+    xdebug-3.1.2 \
   # composer
   && curl --output composer-setup.php https://getcomposer.org/installer \
   && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
   && rm composer-setup.php \
   # xdebug command
   && curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v2.0.0/xdebug \
-  && chmod +x /usr/local/bin/xdebug \
-  # clean up
-  && apk del .build-deps
+  && chmod +x /usr/local/bin/xdebug
 
 COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

+ 9 - 10
docker/php-7.1/Dockerfile → docker/php-8.1/Dockerfile

@@ -1,4 +1,4 @@
-FROM php:7.1-cli-alpine3.10
+FROM php:8.1-cli-alpine3.15
 
 ARG DOCKER_USER_ID
 ARG DOCKER_GROUP_ID
@@ -9,19 +9,18 @@ RUN if ! getent group "${DOCKER_GROUP_ID}" > /dev/null; \
   && if ! getent passwd "${DOCKER_USER_ID}" > /dev/null; \
     then adduser -S -u "${DOCKER_USER_ID}" -G "$(getent group "${DOCKER_GROUP_ID}" | awk -F: '{printf $1}')" dev; \
   fi \
-  && apk add --no-cache git libxml2-dev openssh-client \
-  && apk add --no-cache --virtual .build-deps autoconf g++ make \
-  # xdebug
-  && pecl install xdebug-2.9.8 \
-  && docker-php-ext-enable xdebug \
+  # php extensions
+  && curl --location --output /usr/local/bin/install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
+  && chmod +x /usr/local/bin/install-php-extensions \
+  && sync \
+  && install-php-extensions \
+    xdebug-3.1.2 \
   # composer
   && curl --output composer-setup.php https://getcomposer.org/installer \
   && php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
   && rm composer-setup.php \
   # xdebug command
-  && curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v1.1.0/xdebug \
-  && chmod +x /usr/local/bin/xdebug \
-  # clean up
-  && apk del .build-deps
+  && curl --location --output /usr/local/bin/xdebug https://github.com/julienfalque/xdebug/releases/download/v2.0.0/xdebug \
+  && chmod +x /usr/local/bin/xdebug
 
 COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini

+ 4 - 0
docker/php-8.1/xdebug.ini

@@ -0,0 +1,4 @@
+;zend_extension=xdebug.so
+xdebug.client_host=host.docker.internal
+xdebug.mode=debug
+xdebug.start_with_request=yes