Skip to content
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

gh #498: Use docker alpine image #594

Closed
wants to merge 1 commit into from

Conversation

mzdaniel
Copy link

@mzdaniel mzdaniel commented Jun 6, 2016

Preliminary work to use lightweight docker alpine image.
Created https://github.com/mzdaniel/alpinewheels as pypi doesn't have yet support for musl libc, nor a tag that we can use.
This is a proof of concept to discuss the implementation details and improve it.
Development is working with postgres support and production properly launches all containers (though boto seems to insist in aws credentials raising exception. gunicorn seems to be active)

@mjsisley
Copy link
Contributor

mjsisley commented Jun 6, 2016

I seem to have the same functionality. I hadn't tested aws.
Your approach using wheels is much better than mine. I just installed the dependencies in the Dockerfiles.

What are the sizes of your resulting images?

Also, I swapped redis and nginx to their official alpine images. Postgres doesn't have an official alpine image yet, but there may be soon docker-library/postgres#119.

@audreyfeldroy
Copy link
Member

@mzdaniel Awesome work with this so far!

Question for @jayfk and core devs: There's an edge case affected by this PR, where someone is using Docker in production but not for local development, and they end up with an alpine wheel as part of their local requirements. Is that worth considering, or should we not worry about it?

This is the part I'm thinking about: https://github.com/pydanny/cookiecutter-django/pull/594/files#diff-5b667bb77c1db39af213e1d97dfbde23R20

@mzdaniel
Copy link
Author

mzdaniel commented Jun 6, 2016

Thank you for your comments, @mjsisley and @audreyr
Django image weights so far:
4.8: Linux OS
58: python3 (55.5) + bash + curl
7.5: pip 8.1
117: python packages
Total 188 MB (we'll shave a further 25MB in the next iteration)

If people are for it, I'll work in further optimizing space for our dependencies too.

@jayfk
Copy link
Collaborator

jayfk commented Jun 6, 2016

Looks rock solid. Great work.

One thing we should discuss: I'm not comfortable with making this the default unless there's official support for the wheels being used.

Why?

  • People won't expect to install privately hosted wheels from an unknown source by default unless there's a very good reason for it.
  • Image size/build time is not a good reason.

I'm in favor of adding this as an optional thing for now. This way we can document the advantages and (current) disadvantages of using an alpine based build and there won't be any surprises.

Once all disadvantages are sorted out, we make it the default.

What do you think?

@mzdaniel
Copy link
Author

mzdaniel commented Jun 7, 2016

Sounds good!
I'll adjust the PR accordly. In the meantime, Do people prefer the current way of templating binary
wheels, or have them preloaded with python in an alpine docker container (~75MB)?

@jayfk
Copy link
Collaborator

jayfk commented Jun 7, 2016

+1 binary wheels!

@audreyfeldroy
Copy link
Member

@mzdaniel Were you able to figure out how to automatically upload the wheels to GitHub, or is it a manual process? If manual, I prefer a preloaded Docker image, but if automated, I think I like separate binary wheels. But I'm flexible.

Thoughts on dealing with package version number updates? We recently set up requires.io to send automatic PRs to cookiecutter-django updating requirements files whenever a new version of a package comes out. Perhaps doing the same with alpinewheels and having a core Cookiecutter Django dev (me and/or @jayfk) keep both in sync could be a possible solution, though I'm open to ideas.

@mzdaniel
Copy link
Author

@audreyr and @jayfk . Yes I am aware of these processes. AFAIK the only publicly available alpine builder for our wheels is dockerhub. Currently a github commit automatically launches a docker build. I just don't see there is an interface to publish artifacts back to github though. As @jayfk mention, it seems best for now not to make alpine the default docker image so we can tackle automation and other issues in following iterations as needed.
I do like the idea of requires.io! Why don't deal with it when we concentrate in the automation part?
What is the concensus for offering options (default python3)? alpine + templated wheels, custom python3 with builtin binary wheels.
Regarding hosting, do we have an org for cookiecutter-django on dockerhub/github?

@jayfk
Copy link
Collaborator

jayfk commented Jun 16, 2016

Regarding hosting, do we have an org for cookiecutter-django on dockerhub/github?

There's a organization on dockerhub, but afaik not on github.

@audreyr, @pydanny could you open a cookiecutter org on github and create a django-alpinewheels repo and add @mzdaniel, @mjsisley, @audreyr and me as contributors? This is where we could set up the alpine wheels and possibly find a way to semi automate that.

@audreyfeldroy
Copy link
Member

@jayfk Sure, will do as soon as we get a free moment.

@ssteinerx
Copy link
Contributor

As usual, I vote for moving e.g. Docker support out into its own "plugin/mixin" rather than having it mind-melded into the main project.

The case for separation of concerns is compelling.

@ssteinerx
Copy link
Contributor

Also, this should, in my opinion, be getting done on a sub-branch, based on 1.9-dev, not targeted directly for merge with master. Running everything off master is a very Subversion concept (since branch merging was such a nightmare). With git, branching and merging branches is so easy, there's no reason not to make branches for any non-trivial propositions.

@pydanny pydanny added docker and removed docker labels Feb 13, 2017
@webyneter webyneter added the WIP label Apr 24, 2017
@amcorreia
Copy link

I know it's a bit old issue, but don't make more sense just use python alpine image instead of create a new image?

@pydanny
Copy link
Member

pydanny commented Sep 21, 2017

This PR is so old is there any reason to keep it open?

@mjsisley
Copy link
Contributor

mjsisley commented Sep 21, 2017 via email

@pydanny
Copy link
Member

pydanny commented Sep 22, 2017

Closing this for now. If @mzdaniel or one of the core maintainers wants to reopen it, they can.

@pydanny pydanny closed this Sep 22, 2017
@mzdaniel
Copy link
Author

The underlying issue is there is no alpine psycopg2 wheel available so we can use the python alpine image. This is why we've been talking into hosting such a wheel on a cookiecutter org on github.
As mention, I will take care of the details (I've been blocked by infrastructure needs) if core maintainers support the move to a significantly more lean image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants