Docker manual for OML Computation

This page describes the proces to build your custom docker images for command line version of `Oml Computation' application.

(You can use it similarly to web version, the `OML expression' need to be in double quotes, optionally you can specify `special evaluation' as the second argument (0 for `no' and 1 for `yes') and the number of commutators (`Comm') as third (0 - autodetect, 1-9 - actual number). Examples will be provided later).

Docker image file preparation

I am assuming that you have a functional version of a docker installed (e.g., docker desktop application which is available for multiple platforms).

1) Download and extract the source code into some build directory

2) Fix file permissions (pertinent for unix like systems)

(Without this step, you are not allowed to cd into source code `omlcomput' dir and its subdirectories.)

3) Enter omlcomput directory and create the new Dockerfile file.

4) Put the following entries into it. (Optionally, you can specify other tagged versions of gcc. Available tags are provided at https://hub.docker.com/_/gcc. I have tested it with 4.9 version.)

FROM gcc:4.9
COPY . /usr/src/omlcomput
WORKDIR /usr/src/omlcomput
RUN make
ENTRYPOINT ["/usr/src/omlcomput/eval/fabn6.3.1_eval"]

5) Building the docker image

For example (the name `omlcomput'):

6) Running docker image (assuming the name omlcomput)

Examples

docker run --rm omlcomput - prints the command line options

docker run --rm omlcomput "a v b" - prints evaluation of expression a v b

docker run --rm omlcomput "a v b" 0 2 - assumes that there are two commutators


Building executable using docker version of gcc

Assuming that there is an access to the source directory `omlcomput'. (Points 1) and 2) in the previous section.)

cd omlcomput
docker run --rm -v "$PWD":/usr/src/omlcomput -w /usr/src/omlcomput gcc:4.9 make


Running php version of the application

Assuming that appropriate binary version has been built. (Tested in virtual machine running Ubuntu.) And that we are in omlcomput directory.

Prepare Dockerfile-php file with contents:

FROM php:8.0-apache
WORKDIR /var/www/html
COPY doc/index_savba.php ./index.php
COPY doc/oml-manual.html .
COPY doc/oml-manual.css .
COPY eval/fabn6.3.1_eval .
EXPOSE 80

Modify the index-savba.php file in doc/ directory, on l. 17, ..magic_quotes.. command needs to be removed (commented out) since it is no longer available in PHP 8. Moreover, in order to prevent `non-existing index' warning, it is necessary to add new line after (or replacing) the commented one:

if (!isset($_POST['cmd'])) $_POST['cmd']="";

Building a docker image

docker build -f Dockerfile-php -t phpoml .

Running built docker image (webpage will be available at 8080 port, it can be customized):

docker run -d -p 8080:80 phpoml

Accessing webpage

localhost:8080/

(home and source links does not work)

Note: For VirtualBox it is necessary to allow port forwarding in networking setting. E.g., via graphical user interface, Network - Advanced - Port forwarding, + icon, Name: desired name, Hostport: port on your machine (e.g., 8080), Guestport: 8080.