-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (49 loc) · 1.89 KB
/
Copy pathDockerfile
File metadata and controls
60 lines (49 loc) · 1.89 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM docker.io/library/ros:kilted-ros-core AS build
# Install pixi
RUN apt update && apt install -y git && curl -fsSL https://pixi.sh/install.sh | PIXI_VERSION=0.67.2 bash
ENV PATH="/root/.pixi/bin:$PATH"
# Add base dependencies
COPY aic_example_policies /ws_aic/src/aic/aic_example_policies
COPY aic_model /ws_aic/src/aic/aic_model
COPY aic_interfaces /ws_aic/src/aic/aic_interfaces
COPY aic_utils /ws_aic/src/aic/aic_utils
COPY pixi.toml pixi.lock /ws_aic/src/aic/
COPY pixi_env_setup.sh /ws_aic/src/aic/
# Add other dependencies
SHELL ["/bin/bash", "-c"]
RUN --mount=type=cache,target=/root/.cache/rattler/cache --mount=type=cache,target=/ws_aic/src/aic/.pixi/build \
cd /ws_aic/src/aic && pixi install --locked
WORKDIR /ws_aic/src/aic
COPY --chmod=755 <<"EOF" /entrypoint.sh
#!/bin/bash
set -e
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
if [[ -z "$AIC_ROUTER_ADDR" ]]; then
echo "AIC_ROUTER_ADDR must be provided"
exit 1
fi
should_enable_acl() {
[[ "$AIC_ENABLE_ACL" == "true" || "$AIC_ENABLE_ACL" == "1" ]]
}
# prepare the credentials file
if should_enable_acl; then
if [[ ! (-n "$AIC_MODEL_PASSWD" ) ]]; then
echo "AIC_MODEL_PASSWD must be provided"
exit 1
fi
echo "model:$AIC_MODEL_PASSWD" >> /credentials.txt
fi
# start the model
ZENOH_CONFIG_OVERRIDE='connect/endpoints=["tcp/'"$AIC_ROUTER_ADDR"'"]'
ZENOH_CONFIG_OVERRIDE+=';transport/shared_memory/enabled=false'
if should_enable_acl; then
ZENOH_CONFIG_OVERRIDE+=';transport/auth/usrpwd/user="model"'
ZENOH_CONFIG_OVERRIDE+=';transport/auth/usrpwd/password="'"$AIC_MODEL_PASSWD"'"'
ZENOH_CONFIG_OVERRIDE+=';transport/auth/usrpwd/dictionary_file="/credentials.txt"'
fi
export ZENOH_CONFIG_OVERRIDE
echo "ZENOH_CONFIG_OVERRIDE=$ZENOH_CONFIG_OVERRIDE"
exec pixi run --as-is ros2 run aic_model aic_model "$@"
EOF
ENTRYPOINT ["/entrypoint.sh"]
CMD ["--ros-args", "-p", "policy:=aic_example_policies.ros.CheatCode", "-p", "use_sim_time:=true"]