diff options
author | Robin Windey <ro.windey@gmail.com> | 2023-03-11 12:18:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-31 13:53:03 +0000 |
commit | 16c14c059d03069f7e19e100b60c550e8ac54a38 (patch) | |
tree | da7019badd7e19b25c312488e9fa22eb30e3ca8b /.devcontainer | |
parent | 81df7d636e06d1cf5b4aa6ee8e7be8d8fe73c3c9 (diff) | |
download | nextcloud-server-16c14c059d03069f7e19e100b60c550e8ac54a38.tar.gz nextcloud-server-16c14c059d03069f7e19e100b60c550e8ac54a38.zip |
Minor improvements for devcontainer
* Autostart apache2
* Apply occ installation on start
* Autostart Xdebug on request
* Add DevContainer Xdebug profile
Signed-off-by: GitHub <noreply@github.com>
Diffstat (limited to '.devcontainer')
-rw-r--r-- | .devcontainer/Dockerfile | 8 | ||||
-rw-r--r-- | .devcontainer/codespace.config.php | 1 | ||||
-rw-r--r-- | .devcontainer/devcontainer.json | 25 | ||||
-rw-r--r-- | .devcontainer/docker-compose.yml | 2 | ||||
-rwxr-xr-x | .devcontainer/setup.sh | 22 |
5 files changed, 45 insertions, 13 deletions
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 42d94e9963e..4d579223b8d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -5,7 +5,7 @@ ARG DEBIAN_FRONTEND=noninteractive # PHP RUN apt-get update -y -RUN apt install -y apache2 vim software-properties-common +RUN apt install -y apache2 vim software-properties-common sudo nano RUN add-apt-repository ppa:ondrej/php @@ -42,6 +42,12 @@ RUN apt-get install --no-install-recommends -y \ RUN echo "xdebug.remote_enable = 1" >> /etc/php/8.1/cli/conf.d/20-xdebug.ini RUN echo "xdebug.remote_autostart = 1" >> /etc/php/8.1/cli/conf.d/20-xdebug.ini +# Autostart XDebug for apache +RUN { \ + echo "xdebug.mode=debug"; \ + echo "xdebug.start_with_request=yes"; \ +} >> /etc/php/8.1/apache2/conf.d/20-xdebug.ini + # Docker RUN apt-get -y install \ apt-transport-https \ diff --git a/.devcontainer/codespace.config.php b/.devcontainer/codespace.config.php index 5d883c3c9df..c191698c256 100644 --- a/.devcontainer/codespace.config.php +++ b/.devcontainer/codespace.config.php @@ -16,4 +16,5 @@ $CONFIG = [ if(is_string($codespaceName) && !empty($codespaceName) && is_string($codespaceDomain) && !empty($codespaceDomain)) { $CONFIG['overwritehost'] = $codespaceName . '-80.' . $codespaceDomain; $CONFIG['overwriteprotocol'] = 'https'; + $CONFIG['trusted_domains'] = [ $CONFIG['overwritehost'] ]; } diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f86a8cf3430..2f197a58fed 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -8,15 +8,18 @@ 8080, 8025 ], - "runArgs": [ - "--privileged" - ], - "extensions": [ - "felixfbecker.php-debug", - "felixfbecker.php-intellisense", - "ms-azuretools.vscode-docker" - ], - "settings": { - "php.suggest.basic": false, - } + "customizations": { + "vscode": { + "extensions": [ + "felixfbecker.php-debug", + "felixfbecker.php-intellisense", + "ms-azuretools.vscode-docker", + "xdebug.php-debug" + ], + "settings": { + "php.suggest.basic": false + } + } + }, + "workspaceFolder": "/var/www/html" } diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index ffec604fbb6..cb46f3ce800 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -6,7 +6,7 @@ services: - .:/workspace:cached - /var/run/docker.sock:/var/run/docker-host.sock - ..:/var/www/html - command: /bin/sh -c "while sleep 1000; do :; done" + command: /bin/sh -c "chown -R www-data:www-data /var/www/html && service apache2 start && while sleep 1000; do :; done" ports: - 80:80 - 8080:8080 diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh index 9d2e3d73f98..e3595123b84 100755 --- a/.devcontainer/setup.sh +++ b/.devcontainer/setup.sh @@ -6,3 +6,25 @@ git submodule update --init # Codespace config cp .devcontainer/codespace.config.php config/codespace.config.php + +# Set git safe.directory +git config --global --add safe.directory /var/www/html + +# Onetime installation setup +if [ ! -f "data/.devcontainer-install-complete" ]; then + echo "Running NC installation" + sudo -u www-data php occ maintenance:install \ + --verbose \ + --database=pgsql \ + --database-name=postgres \ + --database-host=127.0.0.1 \ + --database-port=5432 \ + --database-user=postgres \ + --database-pass=postgres \ + --admin-user admin \ + --admin-pass admin && \ + touch "data/.devcontainer-install-complete" +fi + +# Clear caches and stuff ... +service apache2 restart |