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 #246
Add Dockerfile #246
Conversation
Hm, maybe it is missing |
Thanks for the PR! Quick questions because I'm not too familiar with Alpine. Why do we need testing repos? Why do we need to specify all dependencies? You can install python-ctags3 via pip. Edit: We should probably use Docker tags that point to exact klaus pip version requirement and have |
Some of the dependencies are only in testing (as of yet), this may change in the future
I put all the direct dependencies in so they can be installed with the system package manager. Most of the dependencies (or their dependencies recursively) require a full compiler toolchain and some libraries to be built from source (with pip) and this blows up the image size and/or build time. Right now the image builds in <15s for me.
I will give it a shot! |
Sorry second question was not clear; does Alpine not have dependency resolution? For example jinja2 should be a dependency of Flask. |
ah! it does, I took the dependencies from |
Added a build argument that can be used to control the version of klaus that is installed. You can use it like this:
I also moved python-ctags3 into it's own build step, so that all the devel dependencies can be removed in the same layer. This way they stay out of the image size as well. EDIT: for reference, without removing python3-dev, gcc and musl-dev, the image becomes 150MB bigger. Glad I made that change. |
Very very nice! Two things I’m wondering: Does the cleanup also remove all the dependencies (like GCC dependencies)? What’s the best practice regarding CMD and ENDPOINT? |
according to the alpine docs it should, and looking into the image the only wasted files added in that layer are pip cache files. That layer is 771kB in total.
both of these can be overriden by users if they want to, the main difference is that CMD is even easier to override, e.g. with |
Thank you! This is very very nice. Will merge now. Maybe we can even suggest this as the main way to run klaus in the README. |
Do you also happen to know about automatic image building when a release is tagged and pushing it to a Docker registry? Otherwise I’ll look into that. |
I just pushed a change that disables pip caching, but it only removes 70kB. You can force-pull that in if you want, or let it be. docker hub offers that as a free service for public repositories iirc. When you set up the repository there you can link it to the github repo, and it will build on pushes for master by default, and you can set it to build on tag pushes as well. However I don't see a way to make it put the tag into the build arg... |
Ah, apparently that's possible by adding more configuration to the repo: https://docs.docker.com/docker-hub/builds/advanced/ At that point the process is more or less equivalent to setting up a simple bash script that runs |
I've changed Docker image to use the Also added Travis auto builds! |
there is a couple of community-maintained dockerfiles and images out there, but they all seem to be terribly outdated. I managed to put this one together finally; it is based on alpine linux, which makes it very tiny.