Skip to content

Commit c613f1e

Browse files
dockerfiles: migrate to gRPC
Signed-off-by: Bastian Krause <[email protected]>
1 parent 13969df commit c613f1e

File tree

5 files changed

+24
-33
lines changed

5 files changed

+24
-33
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
/.pytest_cache/
1919
/htmlcov/
2020
/labgrid/_version.py
21-
/dockerfiles/staging/crossbar/*
22-
!/dockerfiles/staging/crossbar/places_example.yaml
21+
/dockerfiles/staging/coordinator/*
22+
!/dockerfiles/staging/coordinator/places_example.yaml
2323
/.idea

dockerfiles/Dockerfile

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM debian:bookworm-slim AS labgrid-base
2+
ARG VERSION
23

34
LABEL maintainer="[email protected]"
45

@@ -8,10 +9,12 @@ COPY ./ /opt/labgrid/
89

910
RUN set -e ;\
1011
apt update -q=2 ;\
11-
apt install -q=2 --yes --no-install-recommends python3 python3-dev python3-pip python3-setuptools git build-essential libsnappy-dev ;\
12+
apt install -q=2 --yes --no-install-recommends python3 python3-dev python3-pip python3-setuptools git build-essential ;\
1213
pip3 install --break-system-packages -U pip;\
1314
apt clean ;\
14-
rm -rf /var/lib/apt/lists/*
15+
rm -rf /var/lib/apt/lists/* ;\
16+
cd /opt/labgrid ;\
17+
SETUPTOOLS_SCM_PRETEND_VERSION="$VERSION" pip3 install --break-system-packages --no-cache-dir .
1518

1619
#
1720
# Client
@@ -20,9 +23,7 @@ FROM labgrid-base AS labgrid-client
2023
ARG VERSION
2124

2225
RUN set -e ;\
23-
cd /opt/labgrid ;\
2426
pip3 install --break-system-packages yq ;\
25-
SETUPTOOLS_SCM_PRETEND_VERSION="$VERSION" pip3 install --break-system-packages --no-cache-dir . ;\
2627
apt update -q=2 ;\
2728
apt install -q=2 --yes --no-install-recommends microcom openssh-client rsync jq qemu-system qemu-utils ;\
2829
apt clean ;\
@@ -36,21 +37,13 @@ CMD ["/bin/bash"]
3637
FROM labgrid-base AS labgrid-coordinator
3738
ARG VERSION
3839

39-
ENV CROSSBAR_DIR=/opt/crossbar
40-
41-
RUN set -e ;\
42-
cd /opt/labgrid ;\
43-
pip3 install --break-system-packages virtualenv ;\
44-
SETUPTOOLS_SCM_PRETEND_VERSION="$VERSION" pip3 install --break-system-packages --no-cache-dir . ;\
45-
virtualenv -p python3 crossbar-venv ;\
46-
crossbar-venv/bin/pip3 install --break-system-packages -r crossbar-requirements.txt ;\
47-
sed -i "s#^ executable: .*\$# executable: python3#" .crossbar/config-anonymous.yaml
48-
49-
VOLUME /opt/crossbar
40+
VOLUME /opt/coordinator
5041

5142
EXPOSE 20408
5243

53-
CMD ["/opt/labgrid/crossbar-venv/bin/crossbar", "start", "--config", "/opt/labgrid/.crossbar/config-anonymous.yaml"]
44+
WORKDIR /opt/coordinator
45+
46+
CMD ["/usr/local/bin/labgrid-coordinator"]
5447

5548
#
5649
# Exporter
@@ -61,8 +54,6 @@ ARG VERSION
6154
COPY dockerfiles/exporter/entrypoint.sh /entrypoint.sh
6255

6356
RUN set -e ;\
64-
cd /opt/labgrid ;\
65-
SETUPTOOLS_SCM_PRETEND_VERSION="$VERSION" pip3 install --break-system-packages --no-cache-dir . ;\
6657
apt update -q=2 ;\
6758
apt install -q=2 --yes --no-install-recommends ser2net ;\
6859
apt clean ;\

dockerfiles/README.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This folder contains Dockerfile's for building Docker images
55
for the 3 different components of a Labgrid distributed infrastructure.
66

77
- **labgrid-coordinator**
8-
An image for with crossbar which can be used to run
8+
An image with the Labgrid coordinator.
99
a Labgrid coordinator instance.
1010
- **labgrid-client**
1111
An image with the Labgrid client tools and pytest integration.
@@ -64,18 +64,18 @@ No policy or configuration is done.
6464
labgrid-coordinator usage
6565
~~~~~~~~~~~~~~~~~~~~~~~~~
6666

67-
The labgrid-coordinator comes with a preconfigured Crossbar.io server.
67+
The labgrid-coordinator image can be used to run a coordinator instance.
6868

69-
It listens to port 20408,
69+
It listens on port 20408,
7070
so you probably want to publish that so you can talk to the coordinator.
7171

72-
State is written to ``/opt/crossbar``.
72+
State is written to ``/opt/coordinator``.
7373
You might want to bind a volume to that
74-
so you can restart the service without loosing state.
74+
so you can restart the service without losing state.
7575

7676
.. code-block:: bash
7777
78-
$ docker run -t -p 20408:20408 -v $HOME/crossbar:/opt/crossbar \
78+
$ docker run -t -p 20408:20408 -v $HOME/coordinator:/opt/coordinator \
7979
docker.io/labgrid/coordinator
8080
8181
@@ -85,18 +85,18 @@ labgrid-client usage
8585
The labgrid-client image can be used to
8686
run ``labgrid-client`` and ``pytest`` commands.
8787
For example listing available places registered at coordinator at
88-
ws://192.168.1.42:20408/ws
88+
192.168.1.42:20408
8989

9090
.. code-block:: bash
9191
92-
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws docker.io/labgrid/client \
92+
$ docker run -e LG_COORDINATOR=192.168.1.42:20408 docker.io/labgrid/client \
9393
labgrid-client places
9494
9595
Or running all pytest/labgrid tests at current directory:
9696

9797
.. code-block:: bash
9898
99-
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws docker.io/labgrid/client \
99+
$ docker run -e LG_COORDINATOR=192.168.1.42:20408 docker.io/labgrid/client \
100100
pytest
101101
102102
@@ -113,7 +113,7 @@ Start it with something like:
113113

114114
.. code-block:: bash
115115
116-
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws \
116+
$ docker run -e LG_COORDINATOR=192.168.1.42:20408 \
117117
-v $HOME/exporter-conf:/opt/conf \
118118
docker.io/labgrid/exporter
119119

dockerfiles/staging/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ services:
22
coordinator:
33
image: "${IMAGE_PREFIX:-docker.io/labgrid/}coordinator"
44
volumes:
5-
- "./crossbar:/home/root/crossbar"
5+
- "./coordinator:/home/root/coordinator"
66
tty: true
77
network_mode: "host"
8-
command: bash -c "cp /home/root/crossbar/places_example.yaml /opt/crossbar/places.yaml &&
9-
/opt/labgrid/crossbar-venv/bin/crossbar start --config /opt/labgrid/.crossbar/config-anonymous.yaml"
8+
command: bash -c "cp /home/root/coordinator/places_example.yaml /opt/coordinator/places.yaml &&
9+
/usr/local/bin/labgrid-coordinator"
1010
client:
1111
image: "${IMAGE_PREFIX:-docker.io/labgrid/}client"
1212
volumes:

0 commit comments

Comments
 (0)