Skip to content

Commit 21ce832

Browse files
committed
dockerfiles: Use same default image name as DockerHub
To simplify usage of build.sh on CI, use the same image names for local development as on the Docker hub (i.e. labgrid/client instead of labgrid-client). Allow both the prefix and the tag to be overridden using environment variables. Use the same prefix in docker-compose.yml, customizable using the same environment variable. Adjust the documentation to reflect the new prefix. It is no longer necessary to build the images locally before running docker-compose so remove this part of the staging instructions. Signed-off-by: Peter Hoyes <Peter.Hoyes@arm.com>
1 parent 987aa90 commit 21ce832

3 files changed

Lines changed: 14 additions & 18 deletions

File tree

dockerfiles/README.rst

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Example showing how to build labgrid-client image:
2222

2323
.. code-block:: bash
2424
25-
$ docker build --target labgrid-client -t labgrid-client -f dockerfiles/Dockerfile .
25+
$ docker build --target labgrid-client -t docker.io/labgrid/client -f dockerfiles/Dockerfile .
2626
2727
Using `BuildKit <https://docs.docker.com/develop/develop-images/build_enhancements/>`_
2828
is recommended to reduce build times.
@@ -76,7 +76,7 @@ so you can restart the service without loosing state.
7676
.. code-block:: bash
7777
7878
$ docker run -t -p 20408:20408 -v $HOME/crossbar:/opt/crossbar \
79-
labgrid-coordinator
79+
docker.io/labgrid/coordinator
8080
8181
8282
labgrid-client usage
@@ -89,14 +89,14 @@ ws://192.168.1.42:20408/ws
8989

9090
.. code-block:: bash
9191
92-
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws labgrid-client \
92+
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws 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 labgrid-client \
99+
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws docker.io/labgrid/client \
100100
pytest
101101
102102
@@ -115,7 +115,7 @@ Start it with something like:
115115
116116
$ docker run -e LG_CROSSBAR=ws://192.168.1.42:20408/ws \
117117
-v $HOME/exporter-conf:/opt/conf \
118-
labgrid-exporter
118+
docker.io/labgrid/exporter
119119
120120
If using ser2net or if "exporting" e.g. a serial device, the devices needed must be added to Docker container
121121
(``docker run --device`` option).
@@ -135,14 +135,8 @@ create a setup with the following instances
135135
The environment serves both to allow checking if the environment still function after changes, and can act as an example
136136
how to configure the docker images needed to run a minimal setup.
137137

138-
To use the staging environment to conduct a smoke test first build the images as instructed below:
139-
140-
.. code-block:: bash
141-
142-
$ pip install --upgrade setuptools_scm
143-
$ ./dockerfiles/build.sh
144-
145-
Then use docker compose to start all services except the client:
138+
To use the staging environment to conduct a smoke test, first run docker compose to start all services except the
139+
client:
146140

147141
.. code-block:: bash
148142

dockerfiles/build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22

33
export DOCKER_BUILDKIT=1
4+
: "${IMAGE_PREFIX:=docker.io/labgrid/}"
5+
: "${IMAGE_TAG:=latest}"
46

57
die () {
68
local msg
@@ -59,7 +61,7 @@ perform_regular_build() {
5961

6062
for t in client exporter coordinator; do
6163
"${docker_cmd}" build --build-arg VERSION="${version}" \
62-
--target labgrid-${t} -t labgrid-${t}:latest -f "${script_dir}/Dockerfile" \
64+
--target labgrid-${t} -t "${IMAGE_PREFIX}${t}:${IMAGE_TAG}" -f "${script_dir}/Dockerfile" \
6365
"${extra_args[@]}" .
6466
done
6567
}
@@ -73,7 +75,7 @@ perform_docker_buildx_build() {
7375

7476
for t in client exporter coordinator; do
7577
"${docker_cmd}" buildx build --build-arg VERSION="${version}" \
76-
--target labgrid-${t} -t labgrid-${t}:latest -f "${script_dir}/Dockerfile" \
78+
--target labgrid-${t} -t "${IMAGE_PREFIX}${t}:${IMAGE_TAG}" -f "${script_dir}/Dockerfile" \
7779
"${extra_args[@]}" .
7880
done
7981
}

dockerfiles/staging/docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
version: '3.3'
22
services:
33
coordinator:
4-
image: "labgrid-coordinator"
4+
image: "${IMAGE_PREFIX:-docker.io/labgrid/}coordinator"
55
volumes:
66
- "./crossbar:/home/root/crossbar"
77
tty: true
88
network_mode: "host"
99
command: bash -c "cp /home/root/crossbar/places_example.yaml /opt/crossbar/places.yaml &&
1010
/opt/labgrid/crossbar-venv/bin/crossbar start --config /opt/labgrid/.crossbar/config-anonymous.yaml"
1111
client:
12-
image: "labgrid-client"
12+
image: "${IMAGE_PREFIX:-docker.io/labgrid/}client"
1313
volumes:
1414
- "./client/simple-test:/simple-test"
1515
- "./client/.ssh:/root/.ssh"
@@ -33,7 +33,7 @@ services:
3333
- exporter
3434
- dut
3535
exporter:
36-
image: "labgrid-exporter"
36+
image: "${IMAGE_PREFIX:-docker.io/labgrid/}exporter"
3737
volumes:
3838
- "./exporter-conf:/opt/conf"
3939
- "/run/udev:/run/udev:ro"

0 commit comments

Comments
 (0)