forked from brainelectronics/micropython-modbus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-tcp-test.yaml
62 lines (58 loc) · 1.79 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
#
# 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
container_name: micropython-client
volumes:
- ./:/home
- ./registers:/home/registers
- ./umodbus:/root/.micropython/lib/umodbus
expose:
- "502"
ports:
- "502:502" # reach "micropython-client" at 172.24.0.2:502, see networks
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_tcp_example
container_name: micropython-host
volumes:
- ./:/home
- ./umodbus:/root/.micropython/lib/umodbus
- ./mpy_unittest.py:/root/.micropython/lib/mpy_unittest.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