Skip to content

Commit

Permalink
Merge pull request #6 from yellak/ros-integration-docker-improvement
Browse files Browse the repository at this point in the history
Improving the usage of Docker
  • Loading branch information
daniloinacio authored Nov 24, 2022
2 parents c2ae650 + a0ee1c5 commit 5cc3b80
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 124 deletions.
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ RUN apt-get update && apt-get install -y curl build-essential python-is-python3
RUN curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
RUN python get-pip.py
RUN pip install "poetry==1.1.13"
RUN apt-get -y dist-upgrade

ARG exec_file
ARG simulation_file
ARG map_file

COPY src/ /etc/hmrsim/src
COPY examples/ /etc/hmrsim/examples
COPY ${exec_file} /etc/hmrsim/examples/run.py
COPY ${simulation_file} /etc/hmrsim/examples/simulation.json
COPY ${map_file} /etc/hmrsim/examples/
COPY ./pyproject.toml /etc/hmrsim/pyproject.toml
COPY ./poetry.lock /etc/hmrsim/poetry.lock
COPY ./LICENSE /etc/hmrsim/LICENSE
COPY ./README.md /etc/hmrsim/README.md

WORKDIR /etc/hmrsim
RUN poetry install
WORKDIR /etc/hmrsim/examples

COPY ./hmrsim_entrypoint.sh /hmrsim_entrypoint.sh

Expand Down
15 changes: 7 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
version: "3"

services:
hmrsim-rosbridge:
image: hmrsim-rosbridge
container_name: hmrsim-rosbridge
hmrsim:
image: hmrsim
container_name: hmrsim
build: .
ports:
- 9090:9090
volumes:
- ./src/:/etc/hmrsim/src/
- ./examples:/etc/hmrsim/examples
working_dir: /etc/hmrsim
working_dir: /etc/hmrsim/examples
ports:
- 9090:9090
networks:
- hmrsim
roseer:
image: roseer
container_name: roseer
build: https://github.com/daniloinacio/ROSeer.git#main
depends_on:
- hmrsim-rosbridge
- hmrsim
ports:
- "3000:3000"
networks:
Expand Down
2 changes: 1 addition & 1 deletion examples/hospitalSimulationRos/simulation.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"context": ".",
"map": "examples/hospitalSimulationRos/hospital_scenario.drawio",
"map": "hospital_scenario.drawio",
"FPS": 60,
"DLW": 10,
"verbose": 20
Expand Down
7 changes: 1 addition & 6 deletions hmrsim_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
#!/bin/bash
set -e

# setup poetry shell
# echo "poetry shell" >> /root/.bashrc
# echo "poetry shell" >> /root/.profile

# setup ros2 environment
echo "source \"/opt/ros/$ROS_DISTRO/setup.bash\"" >> /root/.bashrc
echo "source \"/opt/ros/$ROS_DISTRO/setup.bash\"" >> /root/.profile

source /root/.bashrc
source /root/.profile

# run rosbridge server
ros2 launch rosbridge_server rosbridge_websocket_launch.xml
ros2 launch rosbridge_server rosbridge_websocket_launch.xml & poetry run python run.py simulation.json

exec "$@"
Loading

0 comments on commit 5cc3b80

Please sign in to comment.