Add scripts for building/pushing to docker registry
This commit is contained in:
55
scripts/docker_build.sh
Executable file
55
scripts/docker_build.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage:
|
||||
docker_build.sh <target> <registry> [<args>]
|
||||
docker_build.sh -h
|
||||
|
||||
Build and push a docker image to a arm64v8 registry
|
||||
|
||||
Targets:
|
||||
base The pacakges aimed at running on the raspberry pi
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
TARGET="$1"
|
||||
REGISTRY="$2"
|
||||
ARGS="$2"
|
||||
|
||||
if [[ $TARGET == "-h" || $TARGET == "--help" ]]; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
echo "Error: Expected at least 2 arguments."
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
|
||||
|
||||
case $TARGET in
|
||||
"base_env")
|
||||
ssh -N \
|
||||
-o StrictHostKeyChecking=no \
|
||||
-o UserKnownHostsFile=/dev/null \
|
||||
-L *:5000:localhost:5000 \
|
||||
$REGISTRY &
|
||||
|
||||
echo "Building target: base"
|
||||
|
||||
sudo docker buildx build \
|
||||
--platform linux/arm64 \
|
||||
-t host.docker.internal:5000/magrob.env:latest \
|
||||
-f Dockerfile.env \
|
||||
--output type=registry \
|
||||
.
|
||||
;;
|
||||
*)
|
||||
echo "Target not defined"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
17
scripts/install_base_deps.sh
Executable file
17
scripts/install_base_deps.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
ros_distro="jazzy"
|
||||
script_dir=$(dirname "$(readlink -f "${bash_source[0]}")")
|
||||
|
||||
source "/opt/ros/${ROS_DISTRO}/setup.bash"
|
||||
apt update
|
||||
apt-get install -y ros-jazzy-hardware-interface # For some reason this package is problamatic
|
||||
rosdep install -i -y \
|
||||
--from-paths ./mg_bringup \
|
||||
--from-paths ./mg_msgs \
|
||||
--from-paths ./mg_navigation \
|
||||
--from-paths ./mg_control \
|
||||
--from-paths ./mg_odometry \
|
||||
--from-paths ./mg_obstacles \
|
||||
--from-paths ./mg_lidar
|
||||
Reference in New Issue
Block a user