Mojolicious is a real-time web framework and web development toolkit written in Perl.
The images are based on perl:5.32.0 and provide Mojolicious installed together with Cpanel::JSON::XS, DBI, EV, Future::AsyncAwait, IO::Socket::Socks, Net::SSLeay, IO::Socket::SSL, Net::DNS::Native, Role::Tiny, SQL::Abstract.
-
Mojolicious: 8.58, 8, latest (main/Dockerfile)
-
Mojolicious with Mojo::mysql and the MariaDB libraries: 8.58-mariadb, 8-mariadb, mariadb (mariadb/Dockerfile)
-
Mojolicious with Mojo::mysql and the MySQL libraries: 8.58-mysql, 8-mysql, mysql (mysql/Dockerfile)
-
Mojolicious with Mojo::Pg: 8.58-pg, 8-pg, pg (pg/Dockerfile)
-
Mojolicious with Mojo::SQLite: 8.58-sqlite, 8-sqlite, sqlite (sqlite/Dockerfile)
mariadb
and mysql
both include DBD::MariaDB and DBD::mysql. The difference
is in the C libraries they are built with.
Go to your code folder, call Mojolicious to create the basic application structure.
$ docker container run --rm -v "$(pwd):/usr/src/app" tekki/mojolicious mojo generate app MyApp
Start the application as daemon.
$ cd my_app
$ docker container run -d --rm -v "$(pwd):/usr/src/app" -p 3000:3000 tekki/mojolicious morbo script/my_app
To run the container in the foreground and read the output, omit the -d
.
$ docker container run --rm -v "$(pwd):/usr/src/app" -p 3000:3000 tekki/mojolicious morbo script/my_app
Browse to localhost:3000 and edit the code in the current folder. If you are on Linux or MacOS, the server will restart whenever you change a file. On Windows this works if you use Docker Desktop with WSL 2.
The application inside the container always has to run in the foreground. For
hypnotoad use the -f
flag.
$ docker container run -d --rm -v "$(pwd):/usr/src/app" -p 8080:8080 tekki/mojolicious hypnotoad -f script/my_app