-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic build and upload for dashboad (#994)
* Basic build and upload for dashboad Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Default base image Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * install curl Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Passing build args Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Install curl in second step image Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Not install serve globally Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Adding npm bin to path Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Fix entry point with bash too Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Use CMD instead of ENTRYPOINT Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Just use bash at the moment to debug Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Use npx Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Basic api-server image Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Revert dashboard entry script, api-server to enter bash for debugging Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Source minimal rmf instead of ros, before starting api-server Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Make api-server image smaller Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Use strings in dockerfile Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Change default args for whole Dockerfile Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Set builds as nightly, update README Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Point to PMC board Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Share docker images between build steps with dependencies, update README Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Use specific tags to ensure no pulling is involved Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Revert to just use docker registry instead of manual loading Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Inject env script Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Use configurable configs, inject envs before start Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Use nginx instead Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Revert nginx use, run injection script during entrypoint command Signed-off-by: Aaron Chong <aaronchongth@gmail.com> * Revert testing changes, update README Signed-off-by: Aaron Chong <aaronchongth@gmail.com> --------- Signed-off-by: Aaron Chong <aaronchongth@gmail.com>
- Loading branch information
1 parent
957a959
commit f39dfb8
Showing
6 changed files
with
207 additions
and
14 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,47 @@ | ||
ARG BRANCH=main | ||
ARG ROS_DISTRO=jazzy | ||
ARG BASE_IMAGE | ||
|
||
FROM $BASE_IMAGE as base | ||
|
||
ARG BRANCH | ||
|
||
# fetch sources | ||
RUN mkdir -p /ws \ | ||
&& curl -L https://github.com/open-rmf/rmf-web/archive/$BRANCH.tar.gz -o rmf_web.tar.gz \ | ||
&& tar zxf rmf_web.tar.gz -C /ws --strip-components=1 | ||
|
||
# install deps | ||
RUN cd /ws \ | ||
&& pnpm install --filter api-server... | ||
|
||
# cleanup | ||
RUN rm -rf \ | ||
/var/lib/apt/lists \ | ||
/dist | ||
|
||
### Set up minimal image | ||
FROM docker.io/library/ros:$ROS_DISTRO-ros-core | ||
|
||
ARG ROS_DISTRO | ||
|
||
RUN apt update && apt install -y ros-$ROS_DISTRO-rmw-cyclonedds-cpp | ||
|
||
# according to rosdep, the messages have no deps so we can just copy the files directly in! | ||
# this reduces the image size by ~50%. | ||
COPY --from=base /opt/rmf/include /opt/ros/$ROS_DISTRO/include | ||
COPY --from=base /opt/rmf/lib /opt/ros/$ROS_DISTRO/lib | ||
COPY --from=base /opt/rmf/share /opt/ros/$ROS_DISTRO/share | ||
|
||
# Copy over ws alongside the python virtual environment | ||
RUN mkdir /ws | ||
COPY --from=base /ws /ws | ||
|
||
# cleanup | ||
RUN rm -rf \ | ||
/var/lib/apt/lists \ | ||
/dist | ||
|
||
ENV RMF_API_SERVER_CONFIG /ws/packages/api-server/sqlite_local_config.py | ||
WORKDIR /ws/packages/api-server | ||
ENTRYPOINT ["bash", "-c", ". /opt/ros/$ROS_DISTRO/setup.bash && mkdir -p run/cache && ../../.venv/bin/pipenv run python -m api_server"] |
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,41 @@ | ||
ARG BASE_IMAGE | ||
FROM $BASE_IMAGE | ||
ARG BRANCH=main | ||
|
||
### Build dashboard | ||
|
||
# fetch sources | ||
RUN mkdir -p /ws \ | ||
&& curl -L https://github.com/open-rmf/rmf-web/archive/$BRANCH.tar.gz -o rmf_web.tar.gz \ | ||
&& tar zxf rmf_web.tar.gz -C /ws --strip-components=1 | ||
|
||
# install deps | ||
RUN cd /ws \ | ||
&& pnpm install --filter rmf-dashboard... | ||
|
||
# replace configs and build | ||
COPY app-config.json /ws/packages/dashboard/app-config.json | ||
RUN cd /ws/packages/dashboard \ | ||
&& pnpm run build | ||
|
||
### Set up bare minimum dashboard image | ||
|
||
FROM docker.io/ubuntu:24.04 | ||
COPY --from=0 /ws/packages/dashboard/dist /opt/dashboard | ||
|
||
RUN apt update && apt install -y curl | ||
|
||
RUN curl -fsSL https://get.pnpm.io/install.sh | bash - | ||
# shell runs in non-interactive mode, which does not source .bashrc so we need to set the PATH manually | ||
ENV PNPM_HOME /root/.local/share/pnpm | ||
ENV PATH "$PNPM_HOME:$PATH" | ||
|
||
# nodejs seems to have changed the official mirror, the default in pnpm is very slow now | ||
RUN pnpm config -g set 'node-mirror:release' https://nodejs.org/dist && pnpm env use --global lts | ||
|
||
RUN npm install --global serve | ||
ENV PATH "$(npm bin -g):$PATH" | ||
|
||
COPY inject-env.sh /opt/inject-env.sh | ||
|
||
ENTRYPOINT ["bash", "-c", ". /opt/inject-env.sh && npx serve -s /opt/dashboard"] |
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,42 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/open-rmf/rmf-web/main/packages/dashboard/app-config.schema.json", | ||
"rmfServerUrl": "__RMF_SERVER_URL__", | ||
"trajectoryServerUrl": "__TRAJECTORY_SERVER_URL__", | ||
"authConfig": {}, | ||
"helpLink": "https://osrf.github.io/ros2multirobotbook/rmf-core.html", | ||
"reportIssue": "https://github.com/open-rmf/rmf-web/issues", | ||
"pickupZones": [], | ||
"defaultZoom": 20, | ||
"defaultRobotZoom": 6, | ||
"attributionPrefix": "OSRC-SG", | ||
"defaultMapLevel": "L1", | ||
"allowedTasks": [ | ||
{ | ||
"taskDefinitionId": "patrol" | ||
}, | ||
{ | ||
"taskDefinitionId": "delivery" | ||
}, | ||
{ | ||
"taskDefinitionId": "compose-clean" | ||
}, | ||
{ | ||
"taskDefinitionId": "custom_compose" | ||
} | ||
], | ||
"resources": { | ||
"default": { | ||
"fleets": {}, | ||
"logos": { | ||
"header": "/resources/defaultLogo.png" | ||
} | ||
} | ||
}, | ||
"cartIds": [], | ||
"buildConfig": { | ||
"baseUrl": "/", | ||
"authProvider": "stub", | ||
"customTabs": false, | ||
"adminTab": false | ||
} | ||
} |
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,5 @@ | ||
#!/usr/bin/bash | ||
set -e | ||
|
||
sed -i "s,__RMF_SERVER_URL__,${RMF_SERVER_URL},g" /opt/dashboard/index.html | ||
sed -i "s,__TRAJECTORY_SERVER_URL__,${TRAJECTORY_SERVER_URL},g" /opt/dashboard/index.html |
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