Update Create a Mojolicious app with Docker
@@ -1,20 +1,86 @@
|
|||||||
```console
|
```console
|
||||||
$ mkdir mojo-app && cd mojo-app
|
$ mkdir mojo-app && cd mojo-app
|
||||||
$ docker run --rm -it -w /opt/app -v $PWD:/opt/app -p 3000:3000 perl:latest bash
|
$ docker run --rm -it -v $PWD:/usr/src/app -p 3000:3000 perl:latest bash
|
||||||
# cpanm --verbose Carton
|
# cpanm --notest --quiet Carton
|
||||||
|
Successfully installed Path-Tiny-0.150
|
||||||
|
Successfully installed Try-Tiny-0.32
|
||||||
|
Successfully installed Class-Tiny-1.008
|
||||||
|
Successfully installed ExtUtils-Helpers-0.028
|
||||||
|
Successfully installed MIME-Base32-1.303
|
||||||
|
Successfully installed URI-5.35
|
||||||
|
Successfully installed Tie-Handle-Offset-0.004
|
||||||
|
Successfully installed CPAN-DistnameInfo-0.12
|
||||||
|
Successfully installed CPAN-Common-Index-0.010
|
||||||
|
Successfully installed Module-CPANfile-1.1004
|
||||||
|
Successfully installed Win32-ShellQuote-0.003001
|
||||||
|
Successfully installed File-Which-1.27
|
||||||
|
Successfully installed File-pushd-1.016
|
||||||
|
Successfully installed ExtUtils-Config-0.010
|
||||||
|
Successfully installed ExtUtils-InstallPaths-0.015
|
||||||
|
Successfully installed String-ShellQuote-1.04
|
||||||
|
Successfully installed Capture-Tiny-0.50
|
||||||
|
Successfully installed ExtUtils-MakeMaker-CPANfile-0.11
|
||||||
|
Successfully installed Parse-PMFile-0.48
|
||||||
|
Successfully installed local-lib-2.000029
|
||||||
|
Successfully installed IPC-Run3-0.049
|
||||||
|
Successfully installed HTTP-Tinyish-0.20
|
||||||
|
Successfully installed CPAN-Meta-Check-0.018
|
||||||
|
Successfully installed Menlo-1.9019
|
||||||
|
Successfully installed Menlo-Legacy-1.9022
|
||||||
|
Successfully installed Carton-v1.0.35
|
||||||
|
26 distributions installed
|
||||||
# echo "requires 'Mojolicious' => '9.48'," >> cpanfile
|
# echo "requires 'Mojolicious' => '9.48'," >> cpanfile
|
||||||
# carton install
|
# carton install
|
||||||
|
Installing modules using /usr/src/app/cpanfile
|
||||||
|
Successfully installed Mojolicious-9.48
|
||||||
|
1 distribution installed
|
||||||
|
Complete! Modules were installed into /usr/src/app/local
|
||||||
# carton exec -- mojo generate app MojoApp
|
# carton exec -- mojo generate app MojoApp
|
||||||
|
[mkdir] /usr/src/app/mojo_app/script
|
||||||
|
[write] /usr/src/app/mojo_app/script/mojo_app
|
||||||
|
[chmod] /usr/src/app/mojo_app/script/mojo_app 744
|
||||||
|
[mkdir] /usr/src/app/mojo_app/lib
|
||||||
|
[write] /usr/src/app/mojo_app/lib/MojoApp.pm
|
||||||
|
[exist] /usr/src/app/mojo_app
|
||||||
|
[write] /usr/src/app/mojo_app/mojo_app.yml
|
||||||
|
[mkdir] /usr/src/app/mojo_app/lib/MojoApp/Controller
|
||||||
|
[write] /usr/src/app/mojo_app/lib/MojoApp/Controller/Example.pm
|
||||||
|
[mkdir] /usr/src/app/mojo_app/t
|
||||||
|
[write] /usr/src/app/mojo_app/t/basic.t
|
||||||
|
[mkdir] /usr/src/app/mojo_app/public
|
||||||
|
[write] /usr/src/app/mojo_app/public/index.html
|
||||||
|
[mkdir] mojo_app/public/assets
|
||||||
|
[mkdir] /usr/src/app/mojo_app/templates/layouts
|
||||||
|
[write] /usr/src/app/mojo_app/templates/layouts/default.html.ep
|
||||||
|
[mkdir] /usr/src/app/mojo_app/templates/example
|
||||||
|
[write] /usr/src/app/mojo_app/templates/example/welcome.html.ep
|
||||||
# cd mojo_app
|
# cd mojo_app
|
||||||
# carton exec -- morbo script/mojo_app
|
# carton exec -- morbo script/mojo_app
|
||||||
|
Web application available at http://127.0.0.1:3000
|
||||||
```
|
```
|
||||||
|
|
||||||
Visit `localhost:3000` in web browser.
|
Visit `localhost:3000` in web browser.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
# exit
|
# exit
|
||||||
|
exit
|
||||||
$ echo "local" >> .gitignore
|
$ echo "local" >> .gitignore
|
||||||
$ git init
|
$ git init
|
||||||
|
Initialized empty Git repository in /home/[USER NAME]/mojo-app/.git/
|
||||||
$ git add .
|
$ git add .
|
||||||
$ git commit -m "Initial commit"
|
$ git commit -m "Initial commit"
|
||||||
|
[trunk (root-commit) 989c111] Initial commit
|
||||||
|
11 files changed, 203 insertions(+)
|
||||||
|
create mode 100644 .gitignore
|
||||||
|
create mode 100644 cpanfile
|
||||||
|
create mode 100644 cpanfile.snapshot
|
||||||
|
create mode 100644 mojo_app/lib/MojoApp.pm
|
||||||
|
create mode 100644 mojo_app/lib/MojoApp/Controller/Example.pm
|
||||||
|
create mode 100644 mojo_app/mojo_app.yml
|
||||||
|
create mode 100644 mojo_app/public/index.html
|
||||||
|
create mode 100755 mojo_app/script/mojo_app
|
||||||
|
create mode 100644 mojo_app/t/basic.t
|
||||||
|
create mode 100644 mojo_app/templates/example/welcome.html.ep
|
||||||
|
create mode 100644 mojo_app/templates/layouts/default.html.ep
|
||||||
|
$ sudo chown -R $(id -u):$(id -g) .
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user