Skip to content

Commit

Permalink
Removes hardcoded paths in docker compose (#454)
Browse files Browse the repository at this point in the history
Removes hardcoded IsaacLab folder path in docker compose.

## Type of change

- Bug fix

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have run all the tests with `./isaaclab.sh --test` and they pass
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
  • Loading branch information
farbod-farshidian authored Jun 4, 2024
1 parent 55745eb commit ab3a126
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
20 changes: 13 additions & 7 deletions docker/container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ print_help () {
echo -e "\tstop [profile] Stop the docker container and remove it."
echo -e "\tpush [profile] Push the docker image to the cluster."
echo -e "\tjob [profile] [job_args] Submit a job to the cluster."
echo -e "\tconfig [profile] Parse, resolve and render compose file in canonical format."
echo -e "\n"
echo -e "[profile] is the optional container profile specification and [job_args] optional arguments specific"
echo -e "to the executed script"
Expand Down Expand Up @@ -257,7 +258,7 @@ profile_arg="$2" # Capture the second argument as the potential profile argument

# Check mode argument and resolve the container profile
case $mode in
build|start|enter|copy|stop|push)
build|start|enter|copy|stop|push|config)
resolve_image_extension "$profile_arg" true
;;
job)
Expand Down Expand Up @@ -299,10 +300,11 @@ case $mode in
copy)
# Check that desired container is running, exit if it isn't
is_container_running isaac-lab-$container_profile
DOCKER_ISAACLAB_PATH=$(docker exec isaac-lab-$container_profile printenv DOCKER_ISAACLAB_PATH)
echo "[INFO] Copying artifacts from the 'isaac-lab-$container_profile' container..."
echo -e "\t - /workspace/isaaclab/logs -> ${SCRIPT_DIR}/artifacts/logs"
echo -e "\t - /workspace/isaaclab/docs/_build -> ${SCRIPT_DIR}/artifacts/docs/_build"
echo -e "\t - /workspace/isaaclab/data_storage -> ${SCRIPT_DIR}/artifacts/data_storage"
echo -e "\t - ${DOCKER_ISAACLAB_PATH}/logs -> ${SCRIPT_DIR}/artifacts/logs"
echo -e "\t - ${DOCKER_ISAACLAB_PATH}/docs/_build -> ${SCRIPT_DIR}/artifacts/docs/_build"
echo -e "\t - ${DOCKER_ISAACLAB_PATH}/data_storage -> ${SCRIPT_DIR}/artifacts/data_storage"
# enter the script directory
pushd ${SCRIPT_DIR} > /dev/null 2>&1
# We have to remove before copying because repeated copying without deletion
Expand All @@ -315,9 +317,9 @@ case $mode in
mkdir -p ./artifacts/docs

# copy the artifacts
docker cp isaac-lab-$container_profile:/workspace/isaaclab/logs ./artifacts/logs
docker cp isaac-lab-$container_profile:/workspace/isaaclab/docs/_build ./artifacts/docs/_build
docker cp isaac-lab-$container_profile:/workspace/isaaclab/data_storage ./artifacts/data_storage
docker cp isaac-lab-$container_profile:${DOCKER_ISAACLAB_PATH}/logs ./artifacts/logs
docker cp isaac-lab-$container_profile:${DOCKER_ISAACLAB_PATH}/docs/_build ./artifacts/docs/_build
docker cp isaac-lab-$container_profile:${DOCKER_ISAACLAB_PATH}/data_storage ./artifacts/data_storage
echo -e "\n[INFO] Finished copying the artifacts from the container."
popd > /dev/null 2>&1
;;
Expand Down Expand Up @@ -378,6 +380,10 @@ case $mode in
ssh $CLUSTER_LOGIN "cd $CLUSTER_ISAACLAB_DIR && sbatch $CLUSTER_ISAACLAB_DIR/docker/cluster/submit_job.sh" "$CLUSTER_ISAACLAB_DIR" "isaac-lab-$container_profile" "${@:2}"
fi
;;
config)
pushd ${SCRIPT_DIR} > /dev/null 2>&1
docker compose $add_yamls $add_envs $add_profiles config
;;
*)
# Not recognized mode
echo "[Error] Invalid command provided: $mode"
Expand Down
10 changes: 5 additions & 5 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,24 @@ x-default-isaac-lab-volumes: &default-isaac-lab-volumes
# be reflected within the container immediately
- type: bind
source: ../source
target: /workspace/isaaclab/source
target: ${DOCKER_ISAACLAB_PATH}/source
- type: bind
source: ../docs
target: /workspace/isaaclab/docs
target: ${DOCKER_ISAACLAB_PATH}/docs
# The effect of these volumes is twofold:
# 1. Prevent root-owned files from flooding the _build and logs dir
# on the host machine
# 2. Preserve the artifacts in persistent volumes for later copying
# to the host machine
- type: volume
source: isaac-lab-docs
target: /workspace/isaaclab/docs/_build
target: ${DOCKER_ISAACLAB_PATH}/docs/_build
- type: volume
source: isaac-lab-logs
target: /workspace/isaaclab/logs
target: ${DOCKER_ISAACLAB_PATH}/logs
- type: volume
source: isaac-lab-data
target: /workspace/isaaclab/data_storage
target: ${DOCKER_ISAACLAB_PATH}/data_storage

x-default-isaac-lab-environment: &default-isaac-lab-environment
- ISAACSIM_PATH=${DOCKER_ISAACLAB_PATH}/_isaac_sim
Expand Down

0 comments on commit ab3a126

Please sign in to comment.