Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM mcr.microsoft.com/devcontainers/php:1-8.2-bookworm
# All necessary PHP dependnencies
RUN apt update && \
apt install -y \
libpng-dev libjpeg-dev libfreetype6-dev \
libldap2-dev \
build-essential autoconf pkg-config && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install gd mysqli ldap && \
rm -rf /var/lib/apt/lists/*
# Enable Xdebug
RUN XDEBUG_INI="/usr/local/etc/php/conf.d/xdebug.ini" && \
mkdir -p "$(dirname "$XDEBUG_INI")" && \
if ! php -m | grep -qi xdebug; then \
docker-php-ext-install xdebug; \
fi && \
if [ ! -f "$XDEBUG_INI" ]; then \
echo "xdebug.mode=off" > "$XDEBUG_INI" && \
echo "xdebug.start_with_request=no" >> "$XDEBUG_INI" && \
echo "xdebug.client_host=host.docker.internal" >> "$XDEBUG_INI" && \
echo "xdebug.client_port=9003" >> "$XDEBUG_INI"; \
else \
sed -i '/^zend_extension/d' "$XDEBUG_INI"; \
grep -q "xdebug.mode" "$XDEBUG_INI" || echo "xdebug.mode=off" >> "$XDEBUG_INI"; \
grep -q "xdebug.start_with_request" "$XDEBUG_INI" || echo "xdebug.start_with_request=no" >> "$XDEBUG_INI"; \
grep -q "xdebug.client_host" "$XDEBUG_INI" || echo "xdebug.client_host=host.docker.internal" >> "$XDEBUG_INI"; \
grep -q "xdebug.client_port" "$XDEBUG_INI" || echo "xdebug.client_port=9003" >> "$XDEBUG_INI"; \
fi

# Optional: confirm extensions are active for debugging
RUN php -m | grep -E 'mysqli|ldap|gd'
15 changes: 15 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "LibreBooking Dev",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/git-lfs:1": {}
},
"postCreateCommand": "composer install",
"postStartCommand": "bash .devcontainer/ldap_setup.sh",
"forwardPorts": [
8080
],
"remoteUser": "root"
}
6 changes: 6 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Setup LDAP
mkdir -p plugins/Authentication/Ldap plugins/Authentication/ActiveDirectory
echo "<?php return ['enabled' => false];" > plugins/Authentication/Ldap/Ldap.config.php
echo "<?php return ['enabled' => false];" > plugins/Authentication/ActiveDirectory/ActiveDirectory.config.php
# Copy default config to be usable right away for testing
cp config/config.dist.php config/config.php