Jelajahi Sumber

Trying another approach

tyson 8 bulan lalu
induk
melakukan
bc4239db68
3 mengubah file dengan 9 tambahan dan 2 penghapusan
  1. 2 2
      .devcontainer/devcontainer.json
  2. 6 0
      .devcontainer/first-start.sh
  3. 1 0
      .gitignore

+ 2 - 2
.devcontainer/devcontainer.json

@@ -13,9 +13,9 @@
 	"forwardPorts": [],
 
 
-    "initializeCommand": "php artisan migrate --force && php artisan db:seed",
 
-    "postStartCommand": "git config --global --add safe.directory /var/www/html && npm install && composer install && npm run build && apachectl start",
+
+    "postStartCommand": "git config --global --add safe.directory /var/www/html && npm install && composer install && ./.devcontainer/first-start.sh && npm run build && apachectl start",
 
 	// Configure tool-specific properties.
   "customizations" : {

+ 6 - 0
.devcontainer/first-start.sh

@@ -0,0 +1,6 @@
+if [ ! -f ./.devcontainer/first-start.flag ]; then
+    echo "Running first-start commands..."
+    # Add your one-time commands here
+    php artisan migrate --force && php artisan db:seed
+    touch ./.devcontainer/first-start.flag
+fi

+ 1 - 0
.gitignore

@@ -10,6 +10,7 @@
 .env.production
 .phpactor.json
 .phpunit.result.cache
+.devcontainer/first-start.flag
 Homestead.json
 Homestead.yaml
 npm-debug.log