diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000000..de82167b30630 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. +{ + "name": "Joomla! Development", + "dockerComposeFile": "docker-compose.yml", + "service": "app", + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "username": "joomla" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "20" + }, + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/git:1": {} + }, + "onCreateCommand": "sudo chmod +x .devcontainer/install-tools.sh && .devcontainer/install-tools.sh", + "postCreateCommand": "sudo chmod +x .devcontainer/setup.sh && .devcontainer/setup.sh", + "forwardPorts": [ + 8080 + ], + "remoteUser": "joomla" +} \ No newline at end of file diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000000..4d6c5448413eb --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,32 @@ +services: + app: + image: joomla:4.4.8-apache + restart: always + ports: + - 8080:80 + environment: + JOOMLA_DB_HOST: db + JOOMLA_DB_USER: joomla + JOOMLA_DB_PASSWORD: examplepass + JOOMLA_DB_NAME: joomla_db + JOOMLA_SITE_NAME: Joomla + JOOMLA_ADMIN_USER: Joomla Hero + JOOMLA_ADMIN_USERNAME: joomla + JOOMLA_ADMIN_PASSWORD: joomla@secured + JOOMLA_ADMIN_EMAIL: joomla@example.com + volumes: + - ../..:/workspaces:cached + + db: + image: mysql + restart: unless-stopped + environment: + MYSQL_DATABASE: joomla_db + MYSQL_USER: joomla + MYSQL_PASSWORD: examplepass + MYSQL_RANDOM_ROOT_PASSWORD: "1" + volumes: + - db:/var/lib/mysql + +volumes: + db: diff --git a/.devcontainer/install-tools.sh b/.devcontainer/install-tools.sh new file mode 100755 index 0000000000000..ad062af6ed3ea --- /dev/null +++ b/.devcontainer/install-tools.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -eux + +echo "Installing chromium..." +sudo apt-get update +sudo apt-get -y install --no-install-recommends chromium + +# Copy the welcome message +sudo cp .devcontainer/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt \ No newline at end of file diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100755 index 0000000000000..12b8cebed374c --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -eux + +if [ -z ${CODESPACE_NAME+x} ]; then + SITE_HOST="http://localhost:8080" +else + SITE_HOST="https://${CODESPACE_NAME}-8080.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}" +fi + +# Install dependencies diff --git a/.devcontainer/welcome-message.txt b/.devcontainer/welcome-message.txt new file mode 100644 index 0000000000000..f81d421466c83 --- /dev/null +++ b/.devcontainer/welcome-message.txt @@ -0,0 +1,5 @@ +👋 Welcome to "Joomla! Development" in Codespaces! + +🛠️ Your environment is fully setup with all the required software. + +🚀 To get started, wait for the "postCreateCommand" to finish setting things up, then open the portforwarded URL and append '/administrator'.