o3de / ROSConDemo

A robotic fruit picking demo project for O3DE with ROS 2 Gem
Other
80 stars 23 forks source link

Dockerscript should not need to clone the repo that it is in #235

Closed spham-amzn closed 9 months ago

spham-amzn commented 1 year ago

Currently, the Dockerfile designed for this project will clone from the same repo that it is currently already cloned in.

ARG ROSCON_DEMO_REPO=https://github.com/o3de/ROSConDemo.git
ARG ROSCON_DEMO_BRANCH=development

The disadvantage of this is that you cannot make any changes or modifications to test with a Dockerfile unless the changes were merged into the repo. Instead, the Dockerfile should copy the current source into the image instead, but still clone from the other repos

adamdbrw commented 1 year ago

@spham-amzn any progress on this one?

jhanca-robotecai commented 1 year ago

I faced the same question while implementing docker environment for Ros2ProjectTemplate and I decided to keep it as it is. The docker arguments that you showed allow you to change the repo (you can use your own fork) and the branch. Please note, that you can even use a commit's hash code rather than a branch name:

        && git clone $ROSCON_DEMO_REPO \
        && git -C $WORKSPACE/ROSConDemo checkout $ROSCON_DEMO_BRANCH \

(if we wanted to limit ourselves to branch level, we could have used more optimal git clone --depth 1 --branch <branch url instead, which does not pull the whole repository)

adamsj-ros commented 1 year ago

Why not just add o3de and o3de-extras as submodules and then COPY . /data/workspace? Alternatively, clone only o3de and o3de-extras still using the COPY command in the Dockerfile.

michalpelka commented 12 months ago

I think this issue is generalized to other projects.

I am using docker files as a developer's tool that improves my overall experience in implementing new features and maintaining those repos.

In the current approach (with cloning inside docker) I can use the docker script to test a build against a clean environment. With copying/mapping the workspace I can run into issues:

spham-amzn commented 9 months ago

I think we can close this issue. The intent of docker is to provide a consistent environment that is set against known tags if possible. I think this request ultimately defeats that purpose. While the dockerscript itself exists within the same repo that it clones, it should be able to stand alone outside of the repo.