Sign inSign up

stden/compilers

By stden

•Updated 1 day ago

Compile Hello, world! examples in seven languages and check PDF output with two LaTeX engines.

Image
Languages & frameworks
Developer tools
0

1.4K

stden/compilers repository overview

⁠stden/compilers

Compile Hello, world! examples in seven languages and check PDF output with two LaTeX engines.

⁠Overview

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.

⁠Tags

TagMeaningPlatform
latestLatest successful build from main.linux/amd64

View all tags on Docker Hub⁠. The latest tag changes when a new build passes its tests.

⁠Pull the image

docker pull stden/compilers:latest

⁠Run the sample programs

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 formatToolExample
CGCChw_c.c⁠
C++G++hw_cpp.cpp⁠
C#Mono C# and Monohw.cs⁠
DDMDhw_d.d⁠
HaskellGHChw_haskell.hs⁠
PascalFree Pascalhw_pascal.pas⁠
PythonPython 3hw_python.py⁠
PDFpdfLaTeX and LuaLaTeXhw_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

⁠Compile your own code

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.

⁠Source and checks

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

Tag summary

Content type

Image

Digest

sha256:c744a2464…

Size

585.9 MB

Last updated

1 day ago

docker pull stden/compilers