Compile Hello, world! examples in seven languages and check PDF output with two LaTeX engines.
1.4K
Compile Hello, world! examples in seven languages and check PDF output with two LaTeX engines.
This image contains GNU C, GNU C++, Mono C#, DMD for D, GHC for Haskell, Free Pascal, and Python. Python runs from a virtual environment with NumPy and pandas. The image also has pdfLaTeX, LuaLaTeX, PDF text tools, git, curl, wget, and tree.
The base image is debian:stable-slim.
The WORKDIR is /x.
The default command compiles each example and checks its output.
| Tag | Meaning | Platform |
|---|---|---|
latest | Latest successful build from main. | linux/amd64 |
View all tags on Docker Hub.
The latest tag changes when a new build passes its tests.
docker pull stden/compilers:latest
docker run --rm stden/compilers:latest
Each program must print Hello, world!.
Both LaTeX engines must create a PDF with the same text.
The runner stops if a compiler fails, a program fails, or the result is incorrect.
The runner deletes all temporary files after each run.
| Language or format | Tool | Example |
|---|---|---|
| C | GCC | hw_c.c |
| C++ | G++ | hw_cpp.cpp |
| C# | Mono C# and Mono | hw.cs |
| D | DMD | hw_d.d |
| Haskell | GHC | hw_haskell.hs |
| Pascal | Free Pascal | hw_pascal.pas |
| Python | Python 3 | hw_python.py |
| pdfLaTeX and LuaLaTeX | hw_latex.tex |
Expected output:
== Program in C ==
Hello, world!
PASS C
== Program in C++ ==
Hello, world!
PASS C++
== Program in C# ==
Hello, world!
PASS C#
== Program in D ==
Hello, world!
PASS D
== Program in Haskell ==
Hello, world!
PASS Haskell
== Program in Pascal ==
Hello, world!
PASS Pascal
== Program in Python ==
Hello, world!
PASS Python
== Program in pdfLaTeX ==
Hello, world!
PASS pdfLaTeX
== Program in LuaLaTeX ==
Hello, world!
PASS LuaLaTeX
Mount your source directory at /workspace.
Select it with -w /workspace.
The sample programs stay available under /x.
For a C++ source file named main.cpp:
docker run --rm -v "$PWD":/workspace -w /workspace stden/compilers:latest \
bash -c 'g++ main.cpp -o app && ./app'
For a Python source file named main.py:
docker run --rm -v "$PWD":/workspace -w /workspace stden/compilers:latest \
python main.py
For a Haskell source file named main.hs:
docker run --rm -v "$PWD":/workspace -w /workspace stden/compilers:latest \
bash -c 'ghc -o app main.hs && ./app'
Start an interactive shell to use the other compilers:
docker run --rm -it -v "$PWD":/workspace -w /workspace \
stden/compilers:latest bash
New files in /workspace stay in the host directory.
If the included tools are not sufficient, install extra project dependencies in a child image.
The smoke test runs the examples and checks all nine results. Both CI runners use this test. The regression test checks compile failures, runtime failures, incorrect text, PDF failures, and temporary file cleanup.
From the repository root, build the image and test every result:
./test-images.sh compilers
Run the runner regression test without Docker:
bash ci/test-compilers.sh
Content type
Image
Digest
sha256:c744a2464…
Size
585.9 MB
Last updated
1 day ago
docker pull stden/compilers