Skip to content

Instantly share code, notes, and snippets.

@RobDWaller
Created September 23, 2019 12:13
Show Gist options
  • Save RobDWaller/ce1e58df5c5afeeab8ec46fc9b96d46d to your computer and use it in GitHub Desktop.
Save RobDWaller/ce1e58df5c5afeeab8ec46fc9b96d46d to your computer and use it in GitHub Desktop.
Create PHP Docker Environment with Composer and XDebug
# docker-compose.yml
version: "3"
services:
php:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/var/www/html
working_dir: /var/www/html
tty: true
ports:
- "8080:80"
# Dockerfile
FROM php:7.3
RUN apt-get update && apt-get install -y git zip unzip \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php composer-setup.php --install-dir=/usr/local/bin --filename=composer \
&& rm composer-setup.php \
&& docker-php-ext-install bcmath exif
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment