PerlDancer / Dancer2

Perl Dancer Next Generation (rewrite of Perl Dancer)
http://perldancer.org/
Other
544 stars 274 forks source link

Generate a Dockerfile when creating a new app #1589

Closed cromedome closed 3 years ago

cromedome commented 3 years ago

Giving credit where credit is due: I shamelessly stole the sample Dockerfile from Mojolicious. To be fair, this has been on my list for about six months now, but them releasing the feature finally motivated me to do something about it.

You can now run dancer2 gen with a -c or --docker option to produce a minimalist Dockerfile for your application. The gen command will even give you some instructions for how to run it.

This could use a proper deployment guide, but that can be handled in one of the various documentation issues that exist.

cromedome commented 3 years ago

So, to confirm, something like:

on "blazing-speed" => sub {
  requires "URL::Encode::XS"         => "0";
  requires "CGI::Deurl::XS"          => "0";
  requires "HTTP::Parser::XS"        => "0";
  requires "CBOR::XS"                => "0";
  requires "YAML::XS"                => "0";
  requires "Class::XSAccessor"       => "0";
  requires "Cpanel::JSON::XS"        => "0";
  requires "Crypt::URandom"          => "0";
  requires "HTTP::XSCookies"         => "0";
  requires "HTTP::XSHeaders"         => "0";
  requires "Math::Random::ISAAC::XS" => "0";
  requires "MooX::TypeTiny"          => "0";
  requires "Scope::Upper"            => "0";
  requires "Type::Tiny::XS"          => "0";
};

then in the Dockerfile: cpanm --installdeps . --notest --with-blazing-speed?

racke commented 3 years ago

So, to confirm, something like:

on "blazing-speed" => sub {
  requires "URL::Encode::XS"         => "0";
  requires "CGI::Deurl::XS"          => "0";
  requires "HTTP::Parser::XS"        => "0";
  requires "CBOR::XS"                => "0";
  requires "YAML::XS"                => "0";
  requires "Class::XSAccessor"       => "0";
  requires "Cpanel::JSON::XS"        => "0";
  requires "Crypt::URandom"          => "0";
  requires "HTTP::XSCookies"         => "0";
  requires "HTTP::XSHeaders"         => "0";
  requires "Math::Random::ISAAC::XS" => "0";
  requires "MooX::TypeTiny"          => "0";
  requires "Scope::Upper"            => "0";
  requires "Type::Tiny::XS"          => "0";
};

then in the Dockerfile: cpanm --installdeps . --notest --with-blazing-speed?

Well cpanfile docs say:

Describe requirements for a specific phase. Available phases are configure, build, test, runtime and develop.

I thought of "feature accelerate".

cromedome commented 3 years ago

Was spitballing a bit. Just wanted to make sure we were on the same page. Thanks for the info, I'll rework.

cromedome commented 3 years ago

Keeping this open for now, but will reimplement against new CLI when it is ready.

cromedome commented 3 years ago

Closing in favor of #1614.