Skip to content

Commit 2507abd

Browse files
author
MIURA Yasuyuki
committed
add docker setting
1 parent 68cb649 commit 2507abd

File tree

5 files changed

+59
-0
lines changed

5 files changed

+59
-0
lines changed

Dockerfile_Publisher

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.6.9
2+
3+
COPY ./MassRobotics-AMR-MQTT-Client /app
4+
WORKDIR /app
5+
RUN pip install paho-mqtt
6+
7+
ENTRYPOINT python publisher.py mqtt

Dockerfile_Receiver

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:14.16.0-alpine
2+
3+
COPY ./AMR_Interop_Standard.json /app/AMR_Interop_Standard.json
4+
COPY ./examples/statusReport1.json /app/examples/statusReport1.json
5+
COPY ./MassRobotics-AMR-Receiver /app/MassRobotics-AMR-Receiver
6+
WORKDIR /app/MassRobotics-AMR-Receiver
7+
RUN npm run install-server
8+
9+
ENTRYPOINT npm run start

Dockerfile_Sender

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM python:3.6.9
2+
3+
COPY ./MassRobotics-AMR-Sender /app
4+
WORKDIR /app
5+
RUN pip install websockets
6+
7+
ENTRYPOINT python client.py "ws://receiver:3000"

MassRobotics-AMR-MQTT-Client/publisher.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import random
1212
import math
1313
import time
14+
import sys
1415

1516
OPERATIONAL_STATES = ["navigating", "idle", "disabled", "offline", "charging",
1617
"waitingHumanEvent", "waitingExternalEvent", "waitingInternalEvent", "manualOverride"]
@@ -90,6 +91,8 @@ async def sendMessage(host, port, keepalive):
9091

9192
if __name__ == '__main__':
9293
host = "localhost"
94+
if len(sys.argv) > 1:
95+
host = sys.argv[1]
9396
port = 1883
9497
keepalive = 60
9598
asyncio.get_event_loop().run_until_complete(sendMessage(host, port, keepalive))

docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,42 @@
11
version: "3"
22

33
services:
4+
receiver:
5+
image: receiver
6+
build:
7+
context: .
8+
dockerfile: Dockerfile_Receiver
9+
container_name: receiver
10+
depends_on:
11+
- "mqtt"
12+
ports:
13+
- "3000:3000"
14+
volumes:
15+
- node_modules:/app/MassRobotics-AMR-Receiver/node_modules
16+
tty: true
17+
sender:
18+
image: sender
19+
build:
20+
context: .
21+
dockerfile: Dockerfile_Sender
22+
container_name: sender
23+
depends_on:
24+
- "receiver"
25+
tty: true
426
mqtt:
527
build: ./mosquitto
628
hostname: mosquitto
729
container_name: mqtt
830
ports:
931
- "1883:1883"
32+
publisher:
33+
image: publisher
34+
build:
35+
context: .
36+
dockerfile: Dockerfile_Publisher
37+
container_name: publisher
38+
depends_on:
39+
- "receiver"
40+
tty: true
41+
volumes:
42+
node_modules:

0 commit comments

Comments
 (0)