Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more reproducible build for rmf-web #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/.git
2 changes: 2 additions & 0 deletions rmf-web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/src/
/dashboard_resources/
27 changes: 27 additions & 0 deletions rmf-web/build.sh
Original file line number Diff line number Diff line change
@@ -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
20 changes: 9 additions & 11 deletions rmf-web/builder-rmf-web.Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Binary file removed rmf-web/dashboard_resources/caddy.png
Binary file not shown.
Binary file removed rmf-web/dashboard_resources/cleanerBotA.png
Binary file not shown.
Binary file removed rmf-web/dashboard_resources/cleanerBotE.png
Binary file not shown.
Binary file removed rmf-web/dashboard_resources/deliveryRobot.png
Binary file not shown.
Binary file removed rmf-web/dashboard_resources/headerLogo.png
Binary file not shown.
38 changes: 0 additions & 38 deletions rmf-web/dashboard_resources/main.json

This file was deleted.

Binary file removed rmf-web/dashboard_resources/tinyRobot.png
Binary file not shown.
8 changes: 8 additions & 0 deletions rmf-web/fetch-resources.sh
Original file line number Diff line number Diff line change
@@ -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 '**********'
12 changes: 3 additions & 9 deletions rmf-web/rmf-web-dashboard.Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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

###

Expand Down
8 changes: 4 additions & 4 deletions rmf-web/rmf-web-rmf-server.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down