From 472aa82d6f7313592531bbec6c3e94fa0e28fad5 Mon Sep 17 00:00:00 2001 From: Philipp Caspers Date: Thu, 13 Jun 2024 12:32:33 +0200 Subject: [PATCH] ci: Fix entrypoint execution on devcontainer entry --- .devcontainer/Dockerfile | 1 + .devcontainer/devcontainer.json | 2 ++ .devcontainer/entrypoint.sh | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 4bcf6f5..e344725 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -42,3 +42,4 @@ COPY entrypoint.sh / RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] +CMD ["/bin/bash"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 531d797..087ac67 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,6 +5,8 @@ "dockerfile": "Dockerfile" }, "runArgs": ["-v", ".:/workspace"], + "overrideCommand": true, + "postStartCommand": ". /entrypoint.sh", "customizations": { "vscode": { "extensions": [ diff --git a/.devcontainer/entrypoint.sh b/.devcontainer/entrypoint.sh index 4664f3f..09f362f 100644 --- a/.devcontainer/entrypoint.sh +++ b/.devcontainer/entrypoint.sh @@ -1,6 +1,9 @@ #!/bin/bash # Build the package mounted in the container +echo "Building workspace with colcon" . /opt/ros/humble/setup.sh && . /ros_deps/install/setup.sh && colcon build echo "source /workspace/install/setup.sh" >> /root/.bashrc -/bin/bash \ No newline at end of file + +# Run the CMD (either the default from the Dockerfile or the one provided as docker run argument) +exec "$@"