diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..32dd270 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,20 @@ +FROM mcr.microsoft.com/devcontainers/php:1-8.2-bookworm + +# Install MariaDB client and other dependencies +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get install -y mariadb-client libpng-dev libsodium-dev libwebp-dev libfreetype6-dev \ + && apt-get clean -y && rm -rf /var/lib/apt/lists/* + +# Install the PHP extensions we need +RUN docker-php-ext-configure gd \ + --with-webp \ + --with-freetype \ + && docker-php-ext-install gd mysqli pdo pdo_mysql sodium pcntl + +# Enable redis extension +RUN pecl install redis && docker-php-ext-enable redis + +# Configure Xdebug +RUN echo "xdebug.mode=debug" >> /usr/local/etc/php/conf.d/xdebug.ini \ + # && echo "xdebug.start_with_request=trigger" >> /usr/local/etc/php/conf.d/xdebug.ini \ + && echo "xdebug.client_port=9003" >> /usr/local/etc/php/conf.d/xdebug.ini diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..462defc --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/php-mariadb +{ + "name": "Hypixel Signatures", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "forwardPorts": [ + 8000, // artisan serve + 3306, // MySQL + 9003 // Xdebug + ], + "features": { + "ghcr.io/devcontainers/features/node:1": { + "pnpmVersion": "latest" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "EditorConfig.EditorConfig" + ] + } + } +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000..d66f5f6 --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,42 @@ +version: '3.8' + +services: + app: + build: + context: . + dockerfile: Dockerfile + + volumes: + - ../..:/workspaces:cached + + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + + # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. + # Use "forwardPorts" in **devcontainer.json** to forward an app port locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + + db: + image: mariadb:10.4 + restart: unless-stopped + volumes: + - mariadb-data:/var/lib/mysql + network_mode: service:app + environment: + MYSQL_ROOT_PASSWORD: mariadb + MYSQL_DATABASE: homestead + MYSQL_USER: homestead + MYSQL_PASSWORD: secret + # Add "forwardPorts": ["3306"] to **devcontainer.json** to forward MariaDB locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + + redis: + image: redis:6 + restart: unless-stopped + network_mode: service:app + + # Add "forwardPorts": ["6379"] to **devcontainer.json** to forward Redis locally. + # (Adding the "ports" property to this file will not forward from a Codespace.) + +volumes: + mariadb-data: