Mojolicious is a real-time web framework and web development toolkit written in Perl.
The images are based on perl:5.40.0 and provide Mojolicious installed together with Cpanel::JSON::XS, CryptX, DBI, EV, Future::AsyncAwait, IO::Socket::Socks, Net::SSLeay, IO::Socket::SSL, Net::DNS::Native, Role::Tiny, SQL::Abstract.
-
Mojolicious: 9.39, 9, latest (main/Dockerfile)
-
Mojolicious with Mojo::mysql and the MariaDB libraries: 9.39-mariadb, 9-mariadb, mariadb (mariadb/Dockerfile)
-
Mojolicious with Mojo::mysql and the MySQL libraries: 9.39-mysql, 9-mysql, mysql (mysql/Dockerfile)
-
Mojolicious with Mojo::Pg: 9.39-pg, 9-pg, pg (pg/Dockerfile)
-
Mojolicious with Mojo::SQLite: 9.39-sqlite, 9-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 with you as the owner.
$ docker container run --rm -u $UID -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.
To switch from development to production an run the application as daemon in the full featured non-blocking web server start it with
$ docker container run -d --rm -v "$(pwd):/usr/src/app" -p 3000:3000 tekki/mojolicious script/my_app prefork
The source of this image on GitHub.