From fce25b958e5d4677ac6e718269635a8fdbd9a9ea Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Fri, 5 Mar 2021 18:11:23 +0700 Subject: [PATCH] Bugfix, forbidden path outside build context --- README.md | 2 +- docker/Dockerfile | 2 +- docker/entrypoint.sh | 4 ++-- docker/ros2/Dockerfile | 12 ++++++++++++ {ros2 => docker/ros2}/entrypoint.sh | 4 ++-- ros2/Dockerfile | 15 --------------- 6 files changed, 18 insertions(+), 21 deletions(-) create mode 100644 docker/ros2/Dockerfile rename {ros2 => docker/ros2}/entrypoint.sh (84%) delete mode 100644 ros2/Dockerfile diff --git a/README.md b/README.md index bc168a3..e8c963c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ jobs: - name: Checkout uses: actions/checkout@v2.3.4 - name: Build and test - uses: threeal/ros2-ci@v0.2.0 + uses: threeal/ros2-ci@v0.2.1 with: ros2-distro: foxy ``` diff --git a/docker/Dockerfile b/docker/Dockerfile index b4a13bd..c96aafe 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,6 +1,6 @@ FROM docker:latest -COPY ../ros2 /ros2 +COPY ros2 /ros2 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index a00d157..a2e9154 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -1,9 +1,9 @@ #!/bin/bash +cp -r "${GITHUB_REPOSITORY}" "/ros/${GITHUB_WORKSPACE}" + docker build \ --build-args ROS2_DISTRO="$1" \ - --build-args GITHUB_WORKSPACE="$GITHUB_WORKSPACE" \ - --build-args GITHUB_REPOSITORY="$GITHUB_REPOSITORY" \ -t ros2-ci:latest /ros2 || exit $? docker run --rm ros2-ci:latest || exit $? diff --git a/docker/ros2/Dockerfile b/docker/ros2/Dockerfile new file mode 100644 index 0000000..70642af --- /dev/null +++ b/docker/ros2/Dockerfile @@ -0,0 +1,12 @@ +ARG ROS2_DISTRO=foxy + +FROM ros:${ROS2_DISTRO} + +ARG ROS2_DISTRO + +COPY . /ws + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/ros2/entrypoint.sh b/docker/ros2/entrypoint.sh similarity index 84% rename from ros2/entrypoint.sh rename to docker/ros2/entrypoint.sh index 5a6de61..28f549f 100755 --- a/ros2/entrypoint.sh +++ b/docker/ros2/entrypoint.sh @@ -2,12 +2,12 @@ source /opt/ros/${ROS2_DISTRO}/setup.sh || exit $? -cd ws && colcon build \ +cd /ws && colcon build \ --event-handlers console_cohesion+ \ --cmake-args \ --symlink-install || exit $? -cd ws && colcon test \ +cd /ws && colcon test \ --event-handlers console_cohesion+ \ --pytest-with-coverage \ --return-code-on-test-failure || exit $? diff --git a/ros2/Dockerfile b/ros2/Dockerfile deleted file mode 100644 index 8279662..0000000 --- a/ros2/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -ARG ROS2_DISTRO=foxy - -FROM ros:${ROS2_DISTRO} - -ARG ROS2_DISTRO -ARG GITHUB_WORKSPACE -ARG GITHUB_REPOSITORY - -ENV ROS2_DISTRO=${ROS2_DISTRO} -COPY ${GITHUB_WORKSPACE} /ws/${GITHUB_REPOSITORY} - -COPY /ros2/entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh - -ENTRYPOINT ["/entrypoint.sh"]