-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dockerfile generator #1600
Comments
Comment moved to graphql-perl/graphql-perl#29. |
@mohawk2 I strongly disagree, getting it "right" (for whatever definition) from the start is not important at all. All we have to do is give our users a minimal starting point for their first experiments with containerization. Any complexity with multiple dockerfiles would be counter productive. More complex generators can be shipped as 3rd party modules on CPAN. |
(Putting my docker-perl hat on...) Yep, probably simplest is a FROM perl:5.32
ADD . /app
WORKDIR /app
RUN cpanm Mojolicious && cpanm --installdeps .
EXPOSE 3000
CMD ["./script/myapp","prefork"] There are a few assumptions like whether there's a |
The default port 3000 should be fine, no need to make everything configurable. I trust our users do edit a dockerfile if they have to. 😉 The generator should probably output a warning though if a |
Given it's generating in the context of a I would imagine if folks have a FROM perl:5.32
RUN cpanm Mojolicious@8.64
WORKDIR /opt/my_app
COPY . .
EXPOSE 3000
CMD ["./script/my_app", "prefork"] or: FROM perl:5.32
WORKDIR /opt/my_app
COPY . .
RUN cpanm --installdeps .
EXPOSE 3000
CMD ["./script/my_app", "prefork"] |
For the cookbook (to get folks thinking about how to improve their cacheability, etc), I would probably go slightly more complex with something like this, which would dovetail nicely with the makefile generator's output: FROM perl:5.32
WORKDIR /opt/my_app
COPY Makefile.PL .
RUN cpanm --installdeps .
COPY . .
EXPOSE 3000
CMD ["./script/my_app", "prefork"] (This makes sure the |
@tianon The |
Right, so my thought is that this should either use |
Do you think it makes sense to change the output depending on whether a What about for a Lite app - should the result copy just the single script or should it still be basically the same? (Edit: I've pushed the very absolute basics to master...tianon:dockerfile, shamelessly copying from |
If you're creating a dockerfile for a lite app i think we should assume that there's more stuff to be copied in the directory (like templates and static files at least). Edit: Yes, it should detect the right script to put into the dockerfile. |
I've updated master...tianon:dockerfile with a bit more - I'd love some feedback (I'm admittedly a little bit over my own head, but trying to work it out 😅 ❤️). One thing I'm not a huge fan of is that my I'm happy to adjust or even let someone else take over if I'm completely on the wrong track, but I'm also enjoying my attempt. 😄 |
@tianon That might just be the best we can do for script detection. Personally, i don't care too much about the |
Totally fair, and makes sense -- folks who've renamed their I've pushed the updated version to master...tianon:dockerfile -- do you think it's ready for a PR, or is there more I ought to put into this first? |
Sure, there will be style change requests, but it seems enough to get the review process started. |
I want to be able to do
and
to get a minimal but working
Dockerfile
for a Mojolicious app. It should probably start with an official perl container from Docker Hub, runcpanm --installdeps
to install dependencies, and finally start the app in prefork mode. Nothing fancy, just enough to get started.And of course there should be a new recipe in the Deployment section of the cookbook. Describing how to declare dependencies and also showing a minimal
Dockerfile
to build a container for a Mojolicious app.The text was updated successfully, but these errors were encountered: