-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathentrypoint.sh
executable file
·40 lines (35 loc) · 1.67 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env bash
set -euo pipefail
# ------------------------------------------------------------------------------
# Set environment variables for the image, base, and platform.
# ------------------------------------------------------------------------------
export IMAGE="auv-image:latest" # Name of the built Docker image
export BASE_IMAGE="ros:humble-ros-base" # Base image (official ROS 2 Humble)
# ------------------------------------------------------------------------------
# Set the target platform.
# On Darwin (macOS), we force a Linux platform (since Docker builds Linux images),
# otherwise we use the host's architecture.
# ------------------------------------------------------------------------------
if [[ "$(uname)" == "Darwin" ]]; then
export PLATFORM="linux/arm64"
else
export PLATFORM="$(dpkg --print-architecture)"
fi
# ------------------------------------------------------------------------------
# Locate this script and the project root
# ------------------------------------------------------------------------------
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
WORKSPACE="$(realpath "$SCRIPT_DIR/../..")"
# ------------------------------------------------------------------------------
# 1) Build the Docker image
# ------------------------------------------------------------------------------
"$SCRIPT_DIR/docker/build.sh"
# ------------------------------------------------------------------------------
# 2) Run the Docker container
# ------------------------------------------------------------------------------
docker run -it --rm \
--privileged \
--network host \
--ipc=host \
-v "$WORKSPACE":/docker/ws \
"$IMAGE" /bin/bash