Skip to content

Commit

Permalink
First pass adding dockers support including xdebug profile for vscode. (
Browse files Browse the repository at this point in the history
#366)

Co-authored-by: Arvin Singla <arvin@Arvins-MacBook-Pro.local>
  • Loading branch information
arvinsingla and Arvin Singla authored Nov 6, 2023
1 parent fb053b0 commit c27c84a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"log": false,
"pathMappings": {
"/var/www/html/": "${workspaceFolder}"
}
}
]
}
31 changes: 31 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3"

services:
web:
build:
context: ./docker/php
dockerfile: Dockerfile
restart: 'always'
depends_on:
- mariadb
volumes:
- .:/var/www/html/
- ./trust:/var/www/trust
- ./docker/php/conf.d/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
- ./docker/php/conf.d/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini
ports:
- '8080:80'
links:
- mariadb
mariadb:
image: "mariadb"
restart: 'always'
ports:
- 3306:3306
expose:
- "3306"
environment:
MYSQL_ROOT_PASSWORD: "abc123"
MYSQL_DATABASE: "formulize"
MYSQL_USER: "user"
MYSQL_PASSWORD: "password"
7 changes: 7 additions & 0 deletions docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM php:8.1-apache
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev
RUN docker-php-ext-configure gd --with-jpeg=/usr/include/
RUN docker-php-ext-install mysqli pdo pdo_mysql gd
RUN pecl install xdebug
RUN docker-php-ext-enable mysqli pdo pdo_mysql gd xdebug
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
1 change: 1 addition & 0 deletions docker/php/conf.d/error_reporting.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
error_reporting=E_ALL
7 changes: 7 additions & 0 deletions docker/php/conf.d/xdebug.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
zend_extension=xdebug

[xdebug]
xdebug.mode=develop,debug
xdebug.discover_client_host=true
xdebug.client_host=host.docker.internal
xdebug.start_with_request=yes

0 comments on commit c27c84a

Please sign in to comment.