forked from sfera-labs/exo-sense-py-modbus
-
Notifications
You must be signed in to change notification settings - Fork 45
/
docker-compose-rtu-test.yaml
69 lines (64 loc) · 2.02 KB
/
docker-compose-rtu-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
#
# build all non-image containers
# $ docker-compose -f docker-compose-rtu-test.yaml build
# can be combined into one command to also start it afterwards
# $ docker-compose -f docker-compose-rtu-test.yaml up --build
#
version: "3.8"
services:
micropython-client:
build:
context: .
dockerfile: Dockerfile.client_rtu
container_name: micropython-client
volumes:
- ./:/home
- ./registers:/home/registers
- ./umodbus:/root/.micropython/lib/umodbus
- ./fakes:/usr/lib/micropython
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
expose:
- "65433"
ports:
# reach "micropython-client" at 172.25.0.2:65433, see networks
- "65433:65433"
networks:
serial_bridge:
# fix IPv4 address to be known and in the MicroPython scripts
# https://docs.docker.com/compose/compose-file/#ipv4_address
ipv4_address: 172.25.0.2
micropython-host:
build:
context: .
dockerfile: Dockerfile.test_examples
container_name: micropython-host
volumes:
- ./:/home
- ./umodbus:/root/.micropython/lib/umodbus
- ./fakes:/usr/lib/micropython
- ./mpy_unittest.py:/root/.micropython/lib/mpy_unittest.py
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
depends_on:
- micropython-client
command:
- /bin/bash
- -c
- |
micropython-dev -c "import mpy_unittest as unittest; unittest.main(name='tests.test_rtu_example', fromlist=['TestRtuExample'])"
networks:
serial_bridge:
# fix IPv4 address to be known and in the MicroPython scripts
# https://docs.docker.com/compose/compose-file/#ipv4_address
ipv4_address: 172.25.0.3
networks:
serial_bridge:
# use "external: true" if the network already exists
# check available networks with "docker network ls"
# external: true
driver: bridge
# https://docs.docker.com/compose/compose-file/#ipam
ipam:
config:
- subnet: 172.25.0.0/16
gateway: 172.25.0.1