-
Notifications
You must be signed in to change notification settings - Fork 582
Bundling application into Docker image
Pavel Serikov edited this page May 24, 2017
·
10 revisions
Dockerfile
FROM alpine:3.4
MAINTAINER Mojolicious
COPY cpanfile /
ENV EV_EXTRA_DEFS -DEV_NO_ATFORK
RUN apk update && \
apk add perl perl-io-socket-ssl perl-dbd-pg perl-dev g++ make wget curl && \
curl -L https://cpanmin.us | perl - App::cpanminus && \
cpanm --installdeps . -M https://cpan.metacpan.org && \
apk del perl-dev g++ make wget curl && \
rm -rf /root/.cpanm/* /usr/local/share/man/*
# USER daemon
# WORKDIR /
# VOLUME ["/data"]
EXPOSE 3000
CMD ["perl", "-MMojolicious::Lite", "-E", "get '/' =>sub { shift->render(text =>'OK!') }; app->start", "daemon"]
cpanfile
requires "EV";
requires "Mojolicious";
requires "Mojo::Pg";
requires "Mojo::Redis2";
requires "Protocol::Redis::XS";
requires "Mojolicious::Plugin::JSON::XS";
requires "Mojo::IOLoop::ReadWriteFork";
Examples of using docker-compose:
When you need to quicky delpoy your current source code (assuming that appropriate docker image contains all needed perl modules):