Просмотр исходного кода

devcontainer: mount images by symlink

DarthSim 3 месяцев назад
Родитель
Сommit
2b646962ee
4 измененных файлов с 9 добавлено и 3 удалено
  1. 1 0
      .devcontainer/devcontainer.json
  2. 6 2
      .devcontainer/oss/devcontainer.json
  3. 1 0
      .gitignore
  4. 1 1
      Makefile

+ 1 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1 @@
+./oss/devcontainer.json

+ 6 - 2
.devcontainer/oss/devcontainer.json

@@ -15,7 +15,7 @@
     },
     },
     "mounts": [
     "mounts": [
         {
         {
-            "source": "${localWorkspaceFolder}/testdata/test-images",
+            "source": "${localWorkspaceFolder}/.devcontainer/images",
             "target": "/images",
             "target": "/images",
             "type": "bind"
             "type": "bind"
         },
         },
@@ -44,5 +44,9 @@
         }
         }
     },
     },
     "postCreateCommand": "lefthook install",
     "postCreateCommand": "lefthook install",
-    "initializeCommand": "mkdir -p ${localWorkspaceFolder}/.tmp/_dev-root/.cache ${localWorkspaceFolder}/.tmp/_dev-root/go/pkg/mod && touch ${localWorkspaceFolder}/.tmp/_dev-root/.bash_history",
+    "initializeCommand": {
+        "createCacheDirs": "mkdir -p ${localWorkspaceFolder}/.tmp/_dev-root/.cache ${localWorkspaceFolder}/.tmp/_dev-root/go/pkg/mod",
+        "createBashHistory": "touch ${localWorkspaceFolder}/.tmp/_dev-root/.bash_history",
+        "linkImagesDir": "if [ ! -e ${localWorkspaceFolder}/.devcontainer/images ]; then ln -s ${localWorkspaceFolder}/testdata/test-images ${localWorkspaceFolder}/.devcontainer/images; fi"
+    }
 }
 }

+ 1 - 0
.gitignore

@@ -10,3 +10,4 @@ docs/sitemap.txt
 .env
 .env
 .imgproxyrc
 .imgproxyrc
 k6/*.json
 k6/*.json
+.devcontainer/images

+ 1 - 1
Makefile

@@ -159,7 +159,7 @@ _lychee:
 
 
 .PHONY: devcontainer
 .PHONY: devcontainer
 devcontainer:
 devcontainer:
-	devcontainer exec --workspace-folder $(MAKEFILE_DIR) --config .devcontainer/oss/devcontainer.json bash
+	devcontainer exec --workspace-folder $(MAKEFILE_DIR) bash
 
 
 
 
 # Make any unknown target do nothing to avoid "up to date" messages
 # Make any unknown target do nothing to avoid "up to date" messages