Skip to content

Commit 6419bf7

Browse files
authored
Add Dockerfile.386 to test Linux 386 (32 bits architecture) (#1758)
1 parent e9743df commit 6419bf7

File tree

4 files changed

+85
-3
lines changed

4 files changed

+85
-3
lines changed

doc/Building.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Builds a Linux Ubuntu Docker image with fuzzer capable clang++ and all dependenc
295295

296296
### `invoke docker-run`
297297

298-
Runs a container of the Ubuntu Docker image created with `invoke docker`. It automatically executes a `bash` session in the `/mediasoup` directory, which is a Docker volume that points to the mediasoup root folder.
298+
Runs a container of the Ubuntu Docker image created with `invoke docker`. It automatically executes a `bash` session in the mediasoup directory, which is a Docker volume that points to the mediasoup root folder.
299299

300300
**NOTE:** To install and run mediasoup in the container, previous installation (if any) must be properly cleaned by entering the `worker` directory and running `invoke clean-all`.
301301

@@ -305,10 +305,21 @@ Builds a Linux Alpine Docker image with all dependencies to run mediasoup.
305305

306306
### `invoke docker-alpine-run`
307307

308-
Runs a container of the Alpine Docker image created with `invoke docker-alpine`. It automatically executes an `ash` session in the `/mediasoup` directory, which is a Docker volume that points to the mediasoup root folder.
308+
Runs a container of the Alpine Docker image created with `invoke docker-alpine`. It automatically executes an `ash` session in the mediasoup directory, which is a Docker volume that points to the mediasoup root folder.
309309

310310
**NOTE:** To install and run mediasoup in the container, previous installation (if any) must be properly cleaned by entering the `worker` directory and running `invoke clean-all`.
311311

312+
### `invoke docker-386`
313+
314+
Builds a 386 Linux Debian (32 bits arch) Docker image with all dependencies to run mediasoup.
315+
316+
### `invoke docker-alpine-386`
317+
318+
Runs a container of the 386 Linux Debian (32 bits arch) Docker image created with `invoke docker-386`. It automatically executes an `ash` session in the mediasoup directory, which is a Docker volume that points to the mediasoup root folder.
319+
320+
**NOTE:** To install and run mediasoup in the container, previous installation (if any) must be properly cleaned by entering the `worker` directory and running `invoke clean-all`.
321+
**NOTE:** Due to the very old Node v18 in this image, in order to run mediasoup Node tests, `npm ci` must be executed with `--ignore-scripts --engine-strict=false` arguments.
322+
312323
## Makefile
313324

314325
The `worker` folder contains a `Makefile` file for the mediasoup worker C++ subproject. It acts as a proxy to the `Invoke` tasks defined in `tasks.py`. The `Makefile` file exists to help developers or contributors that prefer keep using `make` commands.

worker/Dockerfile.386

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#
2+
# This container installs a 32-bits Linux Debian.
3+
#
4+
5+
FROM debian:bookworm
6+
7+
# Install dependencies.
8+
RUN set -x \
9+
&& apt-get update \
10+
&& apt-get install --yes \
11+
make pkg-config bash-completion wget curl git screen python3-pip python3-yaml \
12+
zlib1g-dev libgss-dev libssl-dev libxml2-dev gdb nodejs npm
13+
14+
# Enable core dumps.
15+
RUN set -x \
16+
&& echo "mkdir -p /tmp/cores && chmod 777 /tmp/cores && echo \"/tmp/cores/core.%e.sig%s.%p\" > /proc/sys/kernel/core_pattern && ulimit -c unlimited" >> ~/.bashrc
17+
18+
ENV LANG="C.UTF-8"
19+
20+
ENV MEDIASOUP_LOCAL_DEV="true"
21+
ENV KEEP_BUILD_ARTIFACTS="1"
22+
23+
WORKDIR "/foo bar/mediasoup"
24+
25+
CMD ["bash"]

worker/Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ endif
4242
docker \
4343
docker-run \
4444
docker-alpine \
45-
docker-alpine-run
45+
docker-alpine-run \
46+
docker-386 \
47+
docker-386-run
4648

4749
default: mediasoup-worker
4850

@@ -131,3 +133,9 @@ docker-alpine: invoke
131133

132134
docker-alpine-run: invoke
133135
"$(PYTHON)" -m invoke docker-alpine-run
136+
137+
docker-386: invoke
138+
"$(PYTHON)" -m invoke docker-386
139+
140+
docker-386-run: invoke
141+
"$(PYTHON)" -m invoke docker-386-run

worker/tasks.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,3 +640,41 @@ def docker_alpine_run(ctx):
640640
pty=True, # NOTE: Needed to enter the terminal of the Docker image.
641641
shell=SHELL
642642
);
643+
644+
645+
@task
646+
def docker_386(ctx):
647+
"""
648+
Build a 386 Linux Debian (32 bits arch) Docker image
649+
"""
650+
if os.getenv('DOCKER_NO_CACHE') == 'true':
651+
with cd_worker():
652+
ctx.run(
653+
f'"{DOCKER}" build --platform linux/386 -f Dockerfile.386 --no-cache --tag mediasoup/docker-386:latest .',
654+
echo=True,
655+
pty=PTY_SUPPORTED,
656+
shell=SHELL
657+
);
658+
else:
659+
with cd_worker():
660+
ctx.run(
661+
f'"{DOCKER}" build --platform linux/386 -f Dockerfile.386 --tag mediasoup/docker-386:latest .',
662+
echo=True,
663+
pty=PTY_SUPPORTED,
664+
shell=SHELL
665+
);
666+
667+
668+
@task
669+
def docker_386_run(ctx):
670+
"""
671+
Run a container of the 386 Linux Debian (32 bits arch) Docker image created
672+
in the docker_386 task
673+
"""
674+
with cd_worker():
675+
ctx.run(
676+
f'"{DOCKER}" run --name=mediasoupDocker386 -it --rm --privileged --cap-add SYS_PTRACE -v "{WORKER_DIR}/../:/foo bar/mediasoup" mediasoup/docker-386:latest',
677+
echo=True,
678+
pty=True, # NOTE: Needed to enter the terminal of the Docker image.
679+
shell=SHELL
680+
);

0 commit comments

Comments
 (0)