diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..cab671e2a3 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,10 @@ +FROM mcr.microsoft.com/devcontainers/php:8.3-bookworm + +# Install PHP 8.3 +RUN apt update && apt install -y libjpeg-dev mariadb-client libpng-dev libxml2-dev libwebp-dev libzip-dev libsodium-dev \ + && rm -rf /var/lib/apt/lists/* + +RUN docker-php-ext-configure gd --with-jpeg --with-webp \ + && docker-php-ext-configure zip \ + && docker-php-ext-install bcmath gd pdo_mysql zip sodium \ + && docker-php-ext-enable bcmath gd pdo_mysql zip sodium diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..4ec2bb9d2b --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,33 @@ +// 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 +{ + "name": "PHP", + "dockerComposeFile": "docker-compose.yaml", + "service": "app", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [ + 80 + ], + "features": { + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers/features/node:1": { + "version": "24", + "pnpmVersion": "latest", + "nvmVersion": "latest" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "fill-labs.dependi", + "ecmel.vscode-html-css", + "p42ai.refactor", + "bradlc.vscode-tailwindcss", + "MaxvanderSchee.web-accessibility", + "dbaeumer.vscode-eslint", + "xdebug.php-pack" + ] + } + } +} \ No newline at end of file diff --git a/.devcontainer/docker-compose.yaml b/.devcontainer/docker-compose.yaml new file mode 100644 index 0000000000..265c90aca2 --- /dev/null +++ b/.devcontainer/docker-compose.yaml @@ -0,0 +1,108 @@ +services: + app: + build: + context: .. + dockerfile: .devcontainer/Dockerfile + volumes: + - ../..:/workspaces:cached + + command: sleep infinity + environment: + DB_CONNECTION: mariadb + DB_HOST: mariadb + DB_PORT: 3306 + DB_DATABASE: panel + DB_USERNAME: pterodactyl + DB_PASSWORD: secret + + REDIS_HOST: redis + REDIS_PASSWORD: null + REDIS_PORT: 6379 + + MAIL_MAILER: smtp + MAIL_HOST: mailhog + MAIL_PORT: 1025 + MAIL_USERNAME: null + MAIL_PASSWORD: null + MAIL_ENCRYPTION: null + MAIL_FROM_ADDRESS: no-reply@example.com + MAIL_FROM_NAME: "Pterodactyl Panel" + + networks: + - devcontainer-net + + depends_on: + - mariadb + - mailhog + - redis + + mariadb: + image: mariadb:12.0-noble + restart: unless-stopped + environment: + MYSQL_ROOT_PASSWORD: rootpassword + MYSQL_DATABASE: panel + MYSQL_USER: pterodactyl + MYSQL_PASSWORD: secret + TZ: UTC + command: + - --character-set-server=utf8mb4 + - --collation-server=utf8mb4_unicode_ci + - --max-allowed-packet=64M + volumes: + - mariadb_data:/var/lib/mysql + expose: + - "3306" + networks: + - devcontainer-net + healthcheck: + test: + [ + "CMD-SHELL", + "mysqladmin ping -h localhost -p${MYSQL_ROOT_PASSWORD} >/dev/null 2>&1 || exit 1", + ] + interval: 10s + timeout: 5s + retries: 5 + start_period: 30s + + mailhog: + image: mailhog/mailhog:latest + restart: unless-stopped + ports: + - "8025:8025" # Web UI + - "1025:1025" # SMTP + environment: + MH_UI_BIND_ADDR: "0.0.0.0:8025" + MH_SMTP_BIND_ADDR: "0.0.0.0:1025" + networks: + - devcontainer-net + healthcheck: + test: + ["CMD-SHELL", "curl -fsS http://localhost:8025/ >/dev/null || exit 1"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + + redis: + image: redis:7 + restart: unless-stopped + command: ["redis-server", "--appendonly", "yes"] + ports: + - "6379:6379" + networks: + - devcontainer-net + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + +volumes: + mariadb_data: + +networks: + devcontainer-net: + driver: bridge diff --git a/.gitignore b/.gitignore index f59b05d1f2..7f571e6e65 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ public/assets/manifest.json docker-compose.* !docker-compose.example.yml !docker-compose.example.yaml +!.devcontainer/docker-compose.yaml # for image related files misc