1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

now everything starts up automatically

This commit is contained in:
Garrett W.
2025-07-27 17:40:28 +00:00
committed by Derick Rethans
parent 56e0e2814f
commit 99388afd4e
2 changed files with 12 additions and 1 deletions

View File

@@ -31,7 +31,11 @@
],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html; test -f composer.json && composer install"
"postCreateCommand": "sudo .devcontainer/post-create.sh && sudo chmod a+x \"$(pwd)\" && sudo ln -s \"$(pwd)\" /var/www/html",
"waitFor": "postCreateCommand",
"postAttachCommand": {
"Server": "apache2ctl start"
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"

7
.devcontainer/post-create.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
test -f composer.json && composer install
sed -i 's/Listen 80$//' /etc/apache2/ports.conf \
&& sed -i 's/<VirtualHost \*:80>/ServerName 127.0.0.1\n<VirtualHost \*:8080>/' /etc/apache2/sites-enabled/000-default.conf \
&& rm -rf /var/www/html