forked from sfera-labs/exo-sense-py-modbus
-
Notifications
You must be signed in to change notification settings - Fork 45
/
docker-compose-tcp-test.yaml
67 lines (62 loc) · 1.93 KB
/
docker-compose-tcp-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
---
#
# build all non-image containers
# $ docker-compose -f docker-compose-tcp-test.yaml build
# can be combined into one command to also start it afterwards
# $ docker-compose -f docker-compose-tcp-test.yaml up --build
#
version: "3.8"
services:
micropython-client:
build:
context: .
dockerfile: Dockerfile.client_tcp
container_name: micropython-client
volumes:
- ./:/home
- ./registers:/home/registers
- ./umodbus:/root/.micropython/lib/umodbus
- ./tests/ulogging.py:/root/.micropython/lib/ulogging.py
expose:
- "502"
ports:
# reach "micropython-client" at 172.24.0.2:502, see networks
- "502:502"
networks:
my_bridge:
# fix IPv4 address to be known and in the MicroPython scripts
# https://docs.docker.com/compose/compose-file/#ipv4_address
ipv4_address: 172.24.0.2
micropython-host:
build:
context: .
dockerfile: Dockerfile.test_examples
container_name: micropython-host
volumes:
- ./:/home
- ./umodbus:/root/.micropython/lib/umodbus
- ./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_tcp_example', fromlist=['TestTcpExample'])"
networks:
my_bridge:
# fix IPv4 address to be known and in the MicroPython scripts
# https://docs.docker.com/compose/compose-file/#ipv4_address
ipv4_address: 172.24.0.3
networks:
my_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.24.0.0/16
gateway: 172.24.0.1