Skip to content

Commit

Permalink
[SETUP] Remove the need for duplicate xdebug dockerfiles.
Browse files Browse the repository at this point in the history
Means we no longer update in both places should we need to add a new
extension or something.
  • Loading branch information
Ian Jenkins committed Mar 25, 2022
1 parent f2f0f6c commit 121b383
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 181 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
paths:
- "docker/**/Dockerfile"
- "docker/app/**/Dockerfile_xdebug"
push:
branches:
- main
Expand All @@ -23,4 +22,4 @@ jobs:
- name: "Lint Dockerfile(s)"
uses: jbergstroem/hadolint-gh-action@v1
with:
dockerfile: "./docker/**/Dockerfile ./docker/app/**/Dockerfile_xdebug"
dockerfile: "./docker/**/Dockerfile"
5 changes: 4 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,25 @@ services:
volumes:
- '.:/var/www/html:cached'
extra_hosts:
- host.docker.internal:host-gateway
- '${LOOPBACK_HOST_NAME}:192.168.35.10' # IP should match the IP address set for nginx below
depends_on:
- database

app_xdebug:
build:
context: docker/app
dockerfile: php${PHP_VERSION:-7.4}/Dockerfile_xdebug
dockerfile: php${PHP_VERSION:-7.4}/Dockerfile
args:
USER_ID: ${USER_ID:-0}
GROUP_ID: ${GROUP_ID:-0}
INSTALL_XDEBUG: true
env_file:
- ./docker/app/.env
volumes:
- '.:/var/www/html:cached'
extra_hosts:
- host.docker.internal:host-gateway
- '${LOOPBACK_HOST_NAME}:192.168.35.10' # IP should match the IP address set for nginx below
depends_on:
- database
Expand Down
2 changes: 1 addition & 1 deletion docker/app/.env.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PHP_XDEBUG_ENABLED=1
PHP_XDEBUG_REMOTE_PORT=9002
# Xdebug remote host likely 192.168.35.1 if not using docker or on linux
# Xdebug remote host likely 192.168.35.1 if not using docker or possibly on linux
PHP_XDEBUG_REMOTE_HOST=host.docker.internal
PHP_XDEBUG_IDKEY=wordpress
PHP_MEMORY_LIMIT=2G
Expand Down
5 changes: 3 additions & 2 deletions docker/app/php7.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ FROM php:7.4.28-fpm

ARG USER_ID
ARG GROUP_ID
ARG INSTALL_XDEBUG

# Do all apt-get installs on one line so they are installed on the same layer
RUN set -eux; \
apt-get -y update; \
apt-get -y install git less zip unzip zlib1g-dev libicu-dev g++ libpng-dev libzip-dev libmagickwand-dev --no-install-recommends; \
apt-get clean && apt-get autoremove; \
rm -rf /var/lib/apt/lists/*; \
pecl install memcache-4.0.5.2; \
pecl install memcache-8.0 && docker-php-ext-enable memcache; \
pecl install imagick && docker-php-ext-enable imagick; \
docker-php-ext-enable memcache; \
[ "${INSTALL_XDEBUG:-false}" = true ] && pecl install xdebug && docker-php-ext-enable xdebug; \
docker-php-ext-configure intl; \
docker-php-ext-install -j"$(nproc)" mysqli opcache zip intl gd

Expand Down
57 changes: 0 additions & 57 deletions docker/app/php7.4/Dockerfile_xdebug

This file was deleted.

5 changes: 3 additions & 2 deletions docker/app/php8.0/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ FROM php:8.0.17-fpm

ARG USER_ID
ARG GROUP_ID
ARG INSTALL_XDEBUG

# Do all apt-get installs on one line so they are installed on the same layer
RUN set -eux; \
apt-get -y update; \
apt-get -y install git less zip unzip zlib1g-dev libicu-dev g++ libpng-dev libzip-dev libmagickwand-dev --no-install-recommends; \
apt-get clean && apt-get autoremove; \
rm -rf /var/lib/apt/lists/*; \
pecl install memcache-8.0; \
pecl install memcache-8.0 && docker-php-ext-enable memcache; \
pecl install imagick && docker-php-ext-enable imagick; \
docker-php-ext-enable memcache; \
[ "${INSTALL_XDEBUG:-false}" = true ] && pecl install xdebug && docker-php-ext-enable xdebug; \
docker-php-ext-configure intl; \
docker-php-ext-install -j"$(nproc)" mysqli opcache zip intl gd

Expand Down
57 changes: 0 additions & 57 deletions docker/app/php8.0/Dockerfile_xdebug

This file was deleted.

5 changes: 3 additions & 2 deletions docker/app/php8.1/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ FROM php:8.1.4-fpm

ARG USER_ID
ARG GROUP_ID
ARG INSTALL_XDEBUG

# Do all apt-get installs on one line so they are installed on the same layer
RUN set -eux; \
apt-get -y update; \
apt-get -y install git less zip unzip zlib1g-dev libicu-dev g++ libpng-dev libzip-dev libmagickwand-dev --no-install-recommends; \
apt-get clean && apt-get autoremove; \
rm -rf /var/lib/apt/lists/*; \
pecl install memcache-8.0; \
pecl install memcache-8.0 && docker-php-ext-enable memcache; \
pecl install imagick && docker-php-ext-enable imagick; \
docker-php-ext-enable memcache; \
[ "${INSTALL_XDEBUG:-false}" = true ] && pecl install xdebug && docker-php-ext-enable xdebug; \
docker-php-ext-configure intl; \
docker-php-ext-install -j"$(nproc)" mysqli opcache zip intl gd

Expand Down
57 changes: 0 additions & 57 deletions docker/app/php8.1/Dockerfile_xdebug

This file was deleted.

0 comments on commit 121b383

Please sign in to comment.