Skip to content

Commit 53193d3

Browse files
author
MIURA Yasuyuki
committed
add docker setting
1 parent 0d4cdfe commit 53193d3

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-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

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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ services:
77
context: .
88
dockerfile: Dockerfile_Receiver
99
container_name: receiver
10+
depends_on:
11+
- "mqtt"
1012
ports:
1113
- "3000:3000"
1214
volumes:
@@ -27,5 +29,14 @@ services:
2729
container_name: mqtt
2830
ports:
2931
- "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
3041
volumes:
3142
node_modules:

0 commit comments

Comments
 (0)