diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d2c6b3f --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +src/.git diff --git a/rmf-web/.gitignore b/rmf-web/.gitignore new file mode 100644 index 0000000..9327a98 --- /dev/null +++ b/rmf-web/.gitignore @@ -0,0 +1,2 @@ +/src/ +/dashboard_resources/ diff --git a/rmf-web/build.sh b/rmf-web/build.sh new file mode 100755 index 0000000..19bd974 --- /dev/null +++ b/rmf-web/build.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +DOCKER_REPO=ghcr.io/open-rmf/rmf_deployment_template +COMMIT_SHA=53e1c128d666933f65677a9fe14cf6c881856af2 +DOMAIN_URL='rmf-deployment-template.open-rmf.org' + +cd "$(dirname $0)" + +mkdir -p src +pushd src +git init +if ! $(git remote | grep -q origin); then + git remote add origin https://github.com/open-rmf/rmf-web.git +else + git remote set-url origin https://github.com/open-rmf/rmf-web.git +fi +git fetch origin --depth=1 $COMMIT_SHA +git checkout $COMMIT_SHA +popd + +mkdir -p dashboard_resources +./fetch-resources.sh + +docker build -t $DOCKER_REPO/builder-rmf-web:$COMMIT_SHA -f builder-rmf-web.Dockerfile --build-arg BUILDER=$DOCKER_REPO/builder-rmf . +docker build -t $DOCKER_REPO/rmf-dashboard:$COMMIT_SHA --build-arg BUILDER=$DOCKER_REPO/builder-rmf-web:$COMMIT_SHA --build-arg DOMAIN_URL=$DOMAIN_URL - < rmf-web-dashboard.Dockerfile +docker build -t $DOCKER_REPO/rmf-api-server:$COMMIT_SHA --build-arg BUILDER=$DOCKER_REPO/builder-rmf-web:$COMMIT_SHA - < rmf-web-rmf-server.Dockerfile diff --git a/rmf-web/builder-rmf-web.Dockerfile b/rmf-web/builder-rmf-web.Dockerfile index 373778f..04cc5f7 100644 --- a/rmf-web/builder-rmf-web.Dockerfile +++ b/rmf-web/builder-rmf-web.Dockerfile @@ -1,20 +1,18 @@ -FROM ghcr.io/open-rmf/rmf_deployment_template/builder-rmf - -COPY rmf-web/rmf-web.repos /root +ARG BUILDER +FROM $BUILDER SHELL ["bash", "-c"] -RUN mkdir -p /opt/rmf/src -WORKDIR /opt/rmf -RUN vcs import src < /root/rmf-web.repos - -RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ +RUN apt-get update && apt-get install -y python3-pip curl +RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - && \ apt-get update && apt-get install -y nodejs RUN pip3 install pipenv -RUN cd /opt/rmf/src/rmf-web && \ - sed -i '$ d' Pipfile && \ - npm install -g npm@latest && \ +COPY ./src /opt/rmf/src/rmf-web +COPY ./dashboard_resources /opt/rmf/src/rmf-web/packages/dashboard/src/assets/resources +WORKDIR /opt/rmf/src/rmf-web + +RUN npm install -g npm@latest && \ npm config set unsafe-perm && \ npm ci diff --git a/rmf-web/dashboard_resources/caddy.png b/rmf-web/dashboard_resources/caddy.png deleted file mode 100644 index c89a8d9..0000000 Binary files a/rmf-web/dashboard_resources/caddy.png and /dev/null differ diff --git a/rmf-web/dashboard_resources/cleanerBotA.png b/rmf-web/dashboard_resources/cleanerBotA.png deleted file mode 100644 index 3cf2fd8..0000000 Binary files a/rmf-web/dashboard_resources/cleanerBotA.png and /dev/null differ diff --git a/rmf-web/dashboard_resources/cleanerBotE.png b/rmf-web/dashboard_resources/cleanerBotE.png deleted file mode 100644 index ee1c776..0000000 Binary files a/rmf-web/dashboard_resources/cleanerBotE.png and /dev/null differ diff --git a/rmf-web/dashboard_resources/deliveryRobot.png b/rmf-web/dashboard_resources/deliveryRobot.png deleted file mode 100644 index e691296..0000000 Binary files a/rmf-web/dashboard_resources/deliveryRobot.png and /dev/null differ diff --git a/rmf-web/dashboard_resources/headerLogo.png b/rmf-web/dashboard_resources/headerLogo.png deleted file mode 100644 index f87b94b..0000000 Binary files a/rmf-web/dashboard_resources/headerLogo.png and /dev/null differ diff --git a/rmf-web/dashboard_resources/main.json b/rmf-web/dashboard_resources/main.json deleted file mode 100644 index 7a7296d..0000000 --- a/rmf-web/dashboard_resources/main.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "dispensers":{}, - "robots":{ - "cleanerBotA":{ - "icons":{ - "cleanerBotA":"/cleanerBotA.png" - } - }, - "cleanerBotE":{ - "icons":{ - "cleanerBotE":"/cleanerBotE.png" - } - }, - "caddy":{ - "icons":{ - "caddy":"/caddy.png" - } - }, - "deliveryRobot":{ - "icons":{ - "deliveryRobot":"/deliveryRobot.png" - } - }, - "tinyRobot":{ - "icons":{ - "tinyRobot":"/tinyRobot.png" - } - } - }, - "logos":{ - "headerLogo":{ - "icons":{ - "headerLogo":"/headerLogo.png" - } - } - } -} - diff --git a/rmf-web/dashboard_resources/tinyRobot.png b/rmf-web/dashboard_resources/tinyRobot.png deleted file mode 100644 index 2ccedf9..0000000 Binary files a/rmf-web/dashboard_resources/tinyRobot.png and /dev/null differ diff --git a/rmf-web/fetch-resources.sh b/rmf-web/fetch-resources.sh new file mode 100755 index 0000000..9ebe21f --- /dev/null +++ b/rmf-web/fetch-resources.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -e + +# This script should fetch rmf-dashboard resources used by your deployment and put them into `dashboard_resources` directory. + +echo '**********' +echo 'NOTE: Change fetch-resources.sh to configure the resources used by your deployment' +echo '**********' diff --git a/rmf-web/rmf-web-dashboard.Dockerfile b/rmf-web/rmf-web-dashboard.Dockerfile index 0c4d23e..8d9542a 100644 --- a/rmf-web/rmf-web-dashboard.Dockerfile +++ b/rmf-web/rmf-web-dashboard.Dockerfile @@ -1,14 +1,8 @@ -FROM ghcr.io/open-rmf/rmf_deployment_template/builder-rmf-web +ARG BUILDER +FROM $BUILDER SHELL ["bash", "-c"] -RUN mkdir /opt/rmf/src/rmf-web/packages/dashboard/src/assets/resources -COPY rmf-web/dashboard_resources/* /opt/rmf/src/rmf-web/packages/dashboard/src/assets/resources/ - -RUN . /opt/rmf/install/setup.bash - -WORKDIR /opt/rmf/src/rmf-web - ARG DOMAIN_URL="rmf-deployment-template.open-rmf.org" ENV PUBLIC_URL="/dashboard" ENV REACT_APP_TRAJECTORY_SERVER="wss://${DOMAIN_URL}/trajectory" @@ -22,7 +16,7 @@ RUN echo "DOMAIN_URL: $DOMAIN_URL"\ && echo "REACT_APP_AUTH_PROVIDER: $REACT_APP_AUTH_PROVIDER"\ && echo "REACT_APP_KEYCLOAK_CONFIG: $REACT_APP_KEYCLOAK_CONFIG" -RUN cd /opt/rmf/src/rmf-web/packages/dashboard && npm run build +RUN cd packages/dashboard && npm run build ### diff --git a/rmf-web/rmf-web-rmf-server.Dockerfile b/rmf-web/rmf-web-rmf-server.Dockerfile index 68cd758..b72651d 100644 --- a/rmf-web/rmf-web-rmf-server.Dockerfile +++ b/rmf-web/rmf-web-rmf-server.Dockerfile @@ -1,20 +1,20 @@ -FROM ghcr.io/open-rmf/rmf_deployment_template/builder-rmf-web +ARG BUILDER +FROM $BUILDER SHELL ["bash", "-c"] -ENV RMF_SERVER_USE_SIM_TIME=true +ENV RMF_SERVER_USE_SIM_TIME=false RUN . /opt/rmf/install/setup.bash && \ cd /opt/rmf/src/rmf-web && \ cd /opt/rmf/src/rmf-web/packages/api-server && npm run prepack -FROM ghcr.io/open-rmf/rmf_deployment_template/builder-rmf-web +FROM $BUILDER COPY --from=0 /opt/rmf/src/rmf-web/packages/api-server/dist/ . SHELL ["bash", "-c"] RUN pip3 install $(ls -1 | grep '.*.whl')[postgres] -RUN pip3 install paho-mqtt # cleanup RUN rm -rf /opt/rmf/src