mkdir build cd build # Requires mojolicious, you can git clone here also mojo generate app myapp #### # cpanfile requires 'Mojolicious'; # and so on #### # dockerfile FROM alpine:latest RUN apk update && \ apk add perl \ perl-app-cpanminus \ ca-certificates \ wget \ make perl-dev libc-dev gcc && \ update-ca-certificates RUN cpanm -n install Carton && rm -rf /root/.cpanm WORKDIR /usr/src/myapp COPY cpanfile /usr/src/myapp RUN carton install && rm -rf /root/.cpanm COPY myapp/ /usr/src/myapp ENV PATH=$PATH:/usr/src/myapp/local/bin/ ENV PERL5LIB=/usr/src/myapp/local/lib/perl5/ CMD [ "script/myapp","daemon","-m","production","-l","http://*:8080" ] #### # Now to build the image $ docker build -t myapp-container . #### # Run the container with host's port 8081 # mapped to container's port 8080 using the cmd from dockerfile. $ docker container run -p 8081:8080 -d myapp-container # Explore your container using a shell $ docker container run -it myapp-container sh # Run the dev web server on port 8080 # and run the prod web server on port 8081 $ docker container run -p 8080:8080 -it -d myapp-container script/myapp daemon -m production -l http://*:8080 $ docker container run -p 8081:3000 -it myapp-container morbo script/myapp # Stop the container $ docker container ls $ docker container stop (insert container id) # Save the container $ docker save myapp-container > myapp-container.tar