From ee6c503833ce6632a61dfca697f7144ccab8eaac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20S=2E=20Soriano=20P=C3=A9rez?= Date: Fri, 10 Jan 2025 15:09:49 +0100 Subject: [PATCH 1/4] ci: renamed .config to .devcontainer for compliance --- {.config => .devcontainer}/Dockerfile | 0 {.config => .devcontainer}/environment.yml | 0 {.config => .devcontainer}/jupyter/jupyter_server_config.json | 0 {.config => .devcontainer}/jupyter/jupyter_server_config.py | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename {.config => .devcontainer}/Dockerfile (100%) rename {.config => .devcontainer}/environment.yml (100%) rename {.config => .devcontainer}/jupyter/jupyter_server_config.json (100%) rename {.config => .devcontainer}/jupyter/jupyter_server_config.py (100%) diff --git a/.config/Dockerfile b/.devcontainer/Dockerfile similarity index 100% rename from .config/Dockerfile rename to .devcontainer/Dockerfile diff --git a/.config/environment.yml b/.devcontainer/environment.yml similarity index 100% rename from .config/environment.yml rename to .devcontainer/environment.yml diff --git a/.config/jupyter/jupyter_server_config.json b/.devcontainer/jupyter/jupyter_server_config.json similarity index 100% rename from .config/jupyter/jupyter_server_config.json rename to .devcontainer/jupyter/jupyter_server_config.json diff --git a/.config/jupyter/jupyter_server_config.py b/.devcontainer/jupyter/jupyter_server_config.py similarity index 100% rename from .config/jupyter/jupyter_server_config.py rename to .devcontainer/jupyter/jupyter_server_config.py From ef76cddf1e66ecd19f67242a481d723cd30780ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20S=2E=20Soriano=20P=C3=A9rez?= Date: Fri, 10 Jan 2025 15:17:46 +0100 Subject: [PATCH 2/4] ci: Added required files to initialize devcontainer in vscode and codespaces --- .devcontainer/.devcontainer.json | 27 +++++++++++++++++++++++++++ .devcontainer/postCreateCommand.sh | 4 ++++ 2 files changed, 31 insertions(+) create mode 100644 .devcontainer/.devcontainer.json create mode 100644 .devcontainer/postCreateCommand.sh diff --git a/.devcontainer/.devcontainer.json b/.devcontainer/.devcontainer.json new file mode 100644 index 000000000..5261a965a --- /dev/null +++ b/.devcontainer/.devcontainer.json @@ -0,0 +1,27 @@ +{ + "name": "ra2ce_dev_container", + "build": { + "dockerfile": "Dockerfile" + }, + "mounts": [ + "source=ra2ce_docker_env,target=/usr/src/.env,type=volume" + ], + // `git config --global core.autocrlf true` prevents git from showing differences on ALL files when running + // in the ra2ce (linux) container + "postStartCommand": "bash .devcontainer/postCreateCommand.sh", + "customizations": { + "vscode": { + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "ms-python.debugpy", + "ms-python.black-formatter", + "ms-python.isort", + "ms-python.pylint", + "ms-vscode.test-adapter-converter", + "njpwerner.autodocstring" + ] + } + }, + "forwardPorts": [3000] + } \ No newline at end of file diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100644 index 000000000..762c1f439 --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +poetry install +git config --global core.autocrlf true \ No newline at end of file From aa87885d304006e7db6d0470e469cecc633895a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20S=2E=20Soriano=20P=C3=A9rez?= Date: Fri, 10 Jan 2025 15:22:30 +0100 Subject: [PATCH 3/4] ci: Renamed file as it was incorrectly done --- .devcontainer/{.devcontainer.json => devcontainer.json} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .devcontainer/{.devcontainer.json => devcontainer.json} (100%) diff --git a/.devcontainer/.devcontainer.json b/.devcontainer/devcontainer.json similarity index 100% rename from .devcontainer/.devcontainer.json rename to .devcontainer/devcontainer.json From 4d9756a930f0b85fad1b5fd7f5e7f504b35872de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carles=20S=2E=20Soriano=20P=C3=A9rez?= Date: Mon, 3 Feb 2025 19:40:16 +0000 Subject: [PATCH 4/4] ci: Explicit use of the postcreatecommand script --- .devcontainer/devcontainer.json | 6 +++++- .devcontainer/postCreateCommand.sh | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5261a965a..1ebbbfa89 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,11 +4,15 @@ "dockerfile": "Dockerfile" }, "mounts": [ + "source=${localWorkspaceFolder},target=/usr/src/app,type=bind,consistency=cached", "source=ra2ce_docker_env,target=/usr/src/.env,type=volume" ], // `git config --global core.autocrlf true` prevents git from showing differences on ALL files when running // in the ra2ce (linux) container - "postStartCommand": "bash .devcontainer/postCreateCommand.sh", + // `git config --global --add safe.directory ${containerWorkspaceFolder}` allows git to sync with the devcontainer. + "postStartCommand": "poetry install & git config --global core.autocrlf true & git config --global --add safe.directory ${containerWorkspaceFolder}", + // postCreateCommand.sh does not seem to work due to line endings. + // "postStartCommand": "bash .devcontainer/postCreateCommand.sh", "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh index 762c1f439..623638166 100644 --- a/.devcontainer/postCreateCommand.sh +++ b/.devcontainer/postCreateCommand.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash - poetry install -git config --global core.autocrlf true \ No newline at end of file +git config --global core.autocrlf true +git config --global --add safe.directory "/usr/src/app" \ No newline at end of file