-
Notifications
You must be signed in to change notification settings - Fork 533
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
Added Test::Nginx to alpine-fat #58
base: master
Are you sure you want to change the base?
Conversation
@AlecHFerguson Thanks for your pull request. I think it does make sense to add this specific testing package, even though the other distros don't include it (e.g. That said, regarding this specific pull request: Can you install this Test::Nginx without "capanminus"? And whatever extra things get installed and aren't needed, can you uninstall them in the same |
Following what you have, I don't get a clean build:
I tried installing I also installed And then perhaps in the end |
Thanks for the feedback @neomantra . Glad you support the idea. I'm happy to help add to the fat versions for distros as well. I'll do some more research into installing without cpanminus. With all the dependencies that I've switched to using the https url, good call. I generally agree that installing cpanminus via package manager ( As to the failing builds, I'm happy to help debug. The image built cleanly for me so I'm curious what could be different. I'm running Docker for Mac version 17.06, which I don't think should affect it. Is your build environment accessible to me in some way? CI instance I can look at, an AMI I can try? |
After looking at what it is (and seeing that @agentzh recommends it), I think using I'm not able to reproduce the errors that I was talking about after fiddling more and building clean. Maybe there was something stale and whacked. So can you add this to the I'll then re-test the build and squash your commits as one. Thanks! I plan on revamping the Dockerfiles and a build system to use multi-stage builds. That will make managing "fat" builds a lot easier. I'm doing that around Christmas. For OpenResty-packaged variants, I think OpenResty maintains these test packages (e.g. |
@@ -104,6 +106,7 @@ RUN apk add --no-cache --virtual .build-deps \ | |||
--with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1 \ | |||
&& make build \ | |||
&& make install \ | |||
&& PERL_MM_USE_DEFAULT=1 cpan install Test::Nginx \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neomantra I made these changes. Surprisingly, it bumped the image size up from 255 MB to 291 MB. If we're comfortable with that then I can squash as is. I do think the curl approach is perfectly valid, and does avoid having to install cpan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm... I think there might be cpan cache's that need to get deleted too -- /root/.cpan
is taking 55.6M. So after removing cpanminus, there needs to be this line:
&& rm -rf /root/.cpan /tmp/cpan* \
That was a quick glance using find . -name '*cpan*'
within the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, i see you aren't using cpanminus... just put that after the install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gah, sorry again... I think it should just be the build folder? /root/.cpan/build
or perhaps there's a way to tell cpan not to save stuff. The build folder is ~18MB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @neomantra, I'll give this a try. I'm busy all day today but I'll pick this up again in a couple days.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neomantra You were spot on. Removing the /root/.cpan
directory got the image down to 241 MB. Versus the current image that's 234 MB.
@AlecHFerguson Does that |
@neomantra are there any updates on the multi-stage builds ? if not, can you share what should I copy from this image to another alpine image in my own multi-stage dockerfile (of my application, not a fork of this) |
@dorongutman You want to install Test::Nginx in your image? Line 109, cpan install Test::Nginx should do it no? My apologies for neglecting to get this PR finished. I’m traveling for the next couple weeks so have no computer available. Should be able to get back to this in a couple weeks when I get home. Thanks for the reminder. |
@AlecHFerguson no, I want to build openresty in its own image (with all the building dependencies), then copy whatever needed to a clean alpine image |
@AlecHFerguson or for example, copy whatever I need from a |
Here's how to self-service what contents are at that layer:
|
@dorongutman Otherwise, I've not had a chance to use multi-stage builds yet. But the idea is more to have |
I recently discovered this excellent repo when trying to run Test::Nginx tests for my OpenResty project. Test::Nginx wasn't installed so I've gone ahead and added it.
I built an image from this Dockerfile and am able to run tests successfully (getting 'em passing is another matter!)
The current
alpine-fat
image is 234MB; this one is 259MB. So definitely a bit bigger. I still think it's in the spirit of fat to include all build utils, including tests.