Skip to content

Readdressing Docker Refinement#257

Merged
scragly merged 4 commits into
masterfrom
docker-refine2
Sep 23, 2019
Merged

Readdressing Docker Refinement#257
scragly merged 4 commits into
masterfrom
docker-refine2

Conversation

@scragly
Copy link
Copy Markdown
Contributor

@scragly scragly commented Sep 21, 2019

The last docker refinement resulted in uwsgi being installed from apt, which ended up causing an issue where the app was not discovered when the container was run. Due to that, it was set back to the original install through pip and building from source.

This PR applies another method instead, while also looking into the last few things that come to mind that would be able to improve the image speed and size.

uWSGI

A more python-friendly distribution package that is maintained by the original team, pyuwsgi, was found after some looking around and presented an excellent and reliable way to ditch the build dependencies.

The package is already built and has a standard whl available from pypi, allowing the build tools to be removed again while being an exact in-place install with the same behaviour as the original pip package.

Base Image

I took this chance to finally directly compare and evaluate the two mini-debian base images that were in discussion; bitnami/python:3.7-prod and the official dockerhub python:3.7-slim images.

The result was that python:3.7-slim had an approx 15% quicker build time, and the size was 4% smaller during the tests, so I've changed the base image over to it instead.

Wiki & Git

Git was taking a fair amount of time and space, and it appeared to be only needed for the git dependancy wiki, our temporary fork of the django-wiki repo for Django 2.2 compatibility.

Once the main lib releases a package to pypi that has Django 2.2 compatibility, we will be removing this fork and using the normal package again. Since we're not about to change the version until then, I've added a .whl for our forked version and have it set in the Pipfile and Pipfile.lock.

The build-wiki.Dockerfile and build-wiki.sh files are only helpers for making the wiki whl file that I used in laziness and are not used for testing or production. They are simply here for reference and convenience.

Improvements

The uncompressed size has dropped from 516.7MB to 310.9MB
The local build speed has dropped from 1:11 to 38s

Comment thread docker/app/local.Dockerfile Outdated
@scragly scragly merged commit 61b2a1c into master Sep 23, 2019
@scragly scragly deleted the docker-refine2 branch September 23, 2019 01:39
@scragly
Copy link
Copy Markdown
Contributor Author

scragly commented Sep 23, 2019

No downtime this time, and best of all, the entire CI for a merge to master took 3:54, down from an avg time of over 7 minutes.

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants