// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/php-mariadb
// Update the VARIANT arg in docker-compose.yml to pick a PHP version
{
  "name": "PHP & MariaDB (Community)",
  "dockerComposeFile": "docker-compose.yml",
  "service": "app",
  "workspaceFolder": "/workspace",

  // Set *default* container specific settings.json values on container create.
  "settings": {},

  // Add the IDs of extensions you want installed when the container is created.
  "extensions": [
    "xdebug.php-debug",
    "bmewburn.vscode-intelephense-client",
    "mrmlnc.vscode-apache"
  ],

  // For use with PHP or Apache (e.g.php -S localhost:8080 or apache2ctl start)
  "forwardPorts": [8080, 3306],

  // Use 'postCreateCommand' to run commands after the container is created.
  "postCreateCommand": "sudo truncate -s 0 /etc/apache2/ports.conf && sudo rm -f /etc/apache2/sites-enabled/000-default.conf && sudo ln -sf /workspace/.devcontainer/blessing-skin.apache.conf /etc/apache2/sites-enabled/ && ln -sf .devcontainer/.env.devcontainer .env && composer install && yarn install",

  // Start apache2 after the container is started
  "postStartCommand": "apache2ctl start && echo '\\n👉 \\e[0;32mPlease run '\\'yarn build\\'' to build the frontend. Application is available on port 8080.\\e[0m 👈\\n'",

  // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
  "remoteUser": "vscode",
  "features": {
    "powershell": "latest"
  }
}
