From 1bc209d33186c0694d08ccb37c2172c14c48cc6d Mon Sep 17 00:00:00 2001 From: Laurent Constantin Date: Sun, 1 Dec 2024 13:50:56 +0100 Subject: [PATCH] feat(docker): Xdebug support --- Dockerfile | 19 ++++++++++++++----- docker-compose.yml | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ff9ba768..d230ac00 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,25 @@ -FROM ghcr.io/biblioverse/biblioteca-docker:latest +FROM ghcr.io/biblioverse/biblioteca-docker:latest AS base +WORKDIR /var/www/html +FROM base AS prod USER root COPY . /var/www/html - - -WORKDIR /var/www/html - RUN composer install RUN npm install RUN npm run build RUN chown -R www-data:www-data /var/www/html +USER www-data + +FROM base AS dev +USER root +RUN /usr/local/bin/install-php-extensions xdebug + +RUN echo ' \n\ +[xdebug] \n\ +xdebug.idekey=PHPSTORM \n\ +xdebug.mode=off \n\ +xdebug.client_host=host.docker.internal\n ' >> /usr/local/etc/php/conf.d/biblioteca.ini USER www-data \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 648713c5..57bedfb4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,8 @@ services: biblioteca: image: ghcr.io/biblioverse/biblioteca-docker:latest + build: + target: prod command: ["/bin/sh", "-c" , "crontab /var/www/html/config/crontab.txt && apache2-foreground" ] ports: - "48480:8080" # Web