From 32ccca9fa036486106ab8e93ad95c6dc903facc7 Mon Sep 17 00:00:00 2001 From: Go Kudo Date: Thu, 22 Aug 2024 19:34:11 +0000 Subject: [PATCH] [ci skip] improve codespace support --- .devcontainer/devcontainer.json | 4 ++-- Dockerfile | 2 -- pskel.sh | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 92c4cc9..1f7e855 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,8 +13,8 @@ }, "dockerComposeFile": "./../compose.yaml", "service": "shell", - "workspaceFolder": "/pskel", + "workspaceFolder": ".", "mounts": [ - "source=${localWorkspaceFolder},target=/pskel,type=bind,consistency=cached" + "source=${localWorkspaceFolder},target=/workspaces/pskel,type=bind,consistency=cached" ] } diff --git a/Dockerfile b/Dockerfile index 0ff6f99..dc0d336 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,5 +31,3 @@ RUN docker-php-source extract \ COPY ./patches /patches COPY ./ext /ext - -WORKDIR "/pskel" diff --git a/pskel.sh b/pskel.sh index 9b134ac..b088735 100755 --- a/pskel.sh +++ b/pskel.sh @@ -21,9 +21,12 @@ EOF PSKEL_EXT_DIR="/ext" - if test -d "/pskel/ext"; then - echo "[Pskel] Development containers workspace detected, use \"/pskel/ext\"." >&2 - PSKEL_EXT_DIR="/pskel/ext" + if test -d "/workspaces/pskel/ext"; then + echo "[Pskel] Development Containers workspace detected, use \"/workspaces/pskel/ext\"." >&2 + PSKEL_EXT_DIR="/workspaces/pskel/ext" + elif test -d "${CODESPACE_VSCODE_FOLDER}"; then + echo "[Pskel] GitHub Codespace workspace detected, use \"${CODESPACE_VSCODE_FOLDER}/ext\"." >&2 + PSKEL_EXT_DIR="${CODESPACE_VSCODE_FOLDER}/ext" fi /usr/local/bin/php "/usr/src/php/ext/ext_skel.php" --ext "${1}" --dir "/tmp" ${@} @@ -90,9 +93,12 @@ EOF PSKEL_EXT_DIR="/ext" - if test -d "/pskel/ext"; then - echo "[Pskel] Development containers workspace detected, use \"/pskel/ext\"." >&2 - PSKEL_EXT_DIR="/pskel/ext" + if test -d "/workspaces/pskel/ext"; then + echo "[Pskel] Development Containers workspace detected, use \"/workspaces/pskel/ext\"." >&2 + PSKEL_EXT_DIR="/workspaces/pskel/ext" + elif test -d "${CODESPACE_VSCODE_FOLDER}"; then + echo "[Pskel] GitHub Codespace workspace detected, use \"${CODESPACE_VSCODE_FOLDER}/ext\"." >&2 + PSKEL_EXT_DIR="${CODESPACE_VSCODE_FOLDER}/ext" else if test -f "/ext/.gitkeep" && test $(cat "/ext/.gitkeep") = "pskel_uninitialized"; then echo "[Pskel] Uninitialized project detected, initialize default skeleton." >&2