-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor bake config file, much more readable, structured and extendi…
…ble, modify Makefile, add initial Dockerfile.deploy
- Loading branch information
Showing
3 changed files
with
151 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
ARG BASE_IMAGE=osrf/ros:humble-simulation | ||
FROM $BASE_IMAGE | ||
|
||
USER root | ||
|
||
# Essentials | ||
RUN apt-get update && apt-get install --no-install-recommends -y -o Dpkg::Options::="--force-overwrite" \ | ||
ros-humble-navigation2 \ | ||
ros-humble-nav2-bringup \ | ||
ros-humble-rviz2 \ | ||
ros-humble-teleop-twist-keyboard \ | ||
ros-humble-dynamixel-sdk \ | ||
ros-humble-can-msgs \ | ||
ros-humble-ruckig \ | ||
ros-humble-laser-filters \ | ||
ros-humble-domain-bridge \ | ||
ros-humble-rmw-cyclonedds-cpp \ | ||
ros-humble-ros2-control \ | ||
ros-humble-ros2-controllers \ | ||
ros-humble-rqt-common-plugins \ | ||
ros-humble-webots-ros2 \ | ||
ros-humble-dynamixel-workbench-toolbox \ | ||
ros-humble-behaviortree-cpp \ | ||
libopencv-dev \ | ||
# TODO: Question which of these are necessary | ||
python3-pip \ | ||
python3-pil \ | ||
alsa \ | ||
libxshmfence1 \ | ||
libgtk-3-dev \ | ||
git \ | ||
git-lfs \ | ||
curl \ | ||
wget \ | ||
vim \ | ||
rsync \ | ||
dialog \ | ||
fuse | ||
|
||
RUN python3 -m pip install scipy transforms3d | ||
|
||
#HOTFIX: https://github.com/ros-controls/ros2_controllers/issues/482 | ||
RUN wget -O /tmp/diff_drive_controller.deb http://snapshots.ros.org/humble/2022-11-23/ubuntu/pool/main/r/ros-humble-diff-drive-controller/ros-humble-diff-drive-controller_2.12.0-1jammy.20221108.202153_amd64.deb && \ | ||
apt install -y --allow-downgrades /tmp/diff_drive_controller.deb && \ | ||
rm -f /tmp/diff_drive_controller.deb | ||
|
||
# User config | ||
COPY ./config/bashrc /tmp/bashrc | ||
|
||
RUN mkdir -p /memristor && \ | ||
cat /tmp/bashrc >> /memristor/.bashrc && \ | ||
rm -f /tmp/bashrc && \ | ||
mkdir -p /memristor/ros2_ws/src/mep3 | ||
|
||
# Set the working directory | ||
WORKDIR /root/ros2_ws | ||
|
||
RUN git clone https://github.com/memristor/mep3 src/mep3 | ||
|
||
RUN touch src/mep3/mep3_simulation/COLCON_IGNORE | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y python3-vcstool && \ | ||
rosdep update && \ | ||
rosdep install --from-paths src --ignore-src -r -y | ||
|
||
# Build the packages | ||
RUN . /opt/ros/humble/setup.sh && \ | ||
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo | ||
|
||
ENTRYPOINT ["/bin/bash", "-c", "source install/local_setup.bash && exec bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
group "default" { | ||
targets = ["base", "vnc"] | ||
} | ||
|
||
variable "COMMIT_SHA" {} | ||
|
||
variable "GITHUB_REPO" {} | ||
|
||
target "base" { | ||
context = "." | ||
dockerfile = "Dockerfile.base" | ||
tags = [ | ||
// If GITHUB_REPO is not set, then we are building locally | ||
equal("", GITHUB_REPO) ? "mep3:latest" : "", | ||
equal("", GITHUB_REPO) && notequal("", COMMIT_SHA) ? "mep3:${COMMIT_SHA}" : "", | ||
notequal("", GITHUB_REPO) ? "ghcr.io/${GITHUB_REPO}/mep3:latest" : "", | ||
notequal("", GITHUB_REPO) && notequal("", COMMIT_SHA) ? "ghcr.io/${GITHUB_REPO}:${COMMIT_SHA}" : "" | ||
] | ||
// Enable layer caching | ||
cache-from = ["type=gha,scope=mep3"] | ||
cache-to = ["type=gha,mode=max,scope=mep3"] | ||
// for reference, can be passed the same way as --build-arg, this can be completely omitted, and in this configuration will default to values specified in Dockerfile | ||
args = { | ||
DEBIAN_FRONTEND = null, | ||
UID = null, | ||
variable "TARGET_IMAGE_NAME_MAPPING" { | ||
default = { | ||
"base" = "mep3" | ||
"vnc" = "mep3-vnc" | ||
"deploy" = "mep3-deploy" | ||
} | ||
} | ||
|
||
target "vnc" { | ||
context = "." | ||
dockerfile = "Dockerfile.vnc" | ||
contexts = { | ||
mep3 = "target:base" | ||
variable CONTEXTS_MAPPING { | ||
default = { | ||
"vnc" = { | ||
"mep3" = "target:mep3" | ||
} | ||
} | ||
tags = [ | ||
} | ||
|
||
function "eval_tags" { | ||
params = [image_name, commit_sha, github_repo] | ||
result = [ | ||
// If GITHUB_REPO is not set, then we are building locally | ||
equal("", GITHUB_REPO) ? "mep3-vnc:latest" : "", | ||
equal("", GITHUB_REPO) && notequal("", COMMIT_SHA) ? "mep3-vnc:${COMMIT_SHA}" : "", | ||
notequal("", GITHUB_REPO) ? "ghcr.io/${GITHUB_REPO}/mep3-vnc:latest" : "", | ||
notequal("", GITHUB_REPO) && notequal("", COMMIT_SHA) ? "ghcr.io/${GITHUB_REPO}-vnc:${COMMIT_SHA}" : "" | ||
equal("", github_repo) ? image_name : "", | ||
equal("", github_repo) && notequal("", commit_sha) ? "${image_name}:${commit_sha}" : "", | ||
// otherwise, we are building on GitHub Actions | ||
notequal("", github_repo) ? "ghcr.io/${github_repo}/${image_name}:latest" : "", | ||
notequal("", github_repo) && notequal("", commit_sha) ? "ghcr.io/${github_repo}:${commit_sha}" : "" | ||
] | ||
// Enable layer caching | ||
cache-from = ["type=gha,scope=mep3-vnc"] | ||
cache-to = ["type=gha,mode=max,scope=mep3-vnc"] | ||
} | ||
|
||
target "default" { | ||
name = lookup(TARGET_IMAGE_NAME_MAPPING, tgt, "") | ||
matrix = { | ||
tgt = keys(TARGET_IMAGE_NAME_MAPPING) | ||
} | ||
|
||
tags = eval_tags(lookup(TARGET_IMAGE_NAME_MAPPING, tgt, ""), COMMIT_SHA, GITHUB_REPO) | ||
dockerfile = "Dockerfile.${tgt}" | ||
cache-to = [format("%s%s", "type=gha,mode=max,scope=", lookup(TARGET_IMAGE_NAME_MAPPING, tgt, ""))] | ||
cache-from = [format("%s%s", "type=gha,scope=", lookup(TARGET_IMAGE_NAME_MAPPING, tgt, ""))] | ||
|
||
contexts = lookup(CONTEXTS_MAPPING, tgt, {}) | ||
} |