Skip to content

Dockerfile versioning [issue 278] - #286

Merged
robertmartin8 merged 4 commits into
PyPortfolio:v1.4.1from
phschiele:docker-versioning
Feb 18, 2021
Merged

robertmartin8 merged 4 commits into
PyPortfolio:v1.4.1from
phschiele:docker-versioning

Conversation

@phschiele

@phschiele phschiele commented Feb 16, 2021 •

Copy link
Copy Markdown
Contributor

@robertmartin8 This PR is a minimal example of a Dockerfile that handles all of the use cases you describe.

Thomas Schmelzer (couldn't fit the GitHub name from the last commits) has employed some advanced techniques (builder pattern, second Dockerfile for binder, adding hardcoded usernames (?)) to deal with some limitations that I was confronted with as well. I have gone with a more simplistic setup, which sacrifices some configurability.

The main features are:

  • launching local iPython kernels / jupyter notebook servers from the Dockerfile
  • moving Dockerfile to docker/, as binder otherwise always uses the Dockerfile instead of installing requirements.txt

Caveats:

  • requirements.txt installation on binder is not using ==. This again does not guarantee full reproducibility. Sadly, I did not find an easy way to use poetry.lock or Pipfile.lock directly from binder (at least while a requirements.txt file is present as well). Note that this is the current state as well.

Final remarks:

  • Check out binder working here
  • A quick overview of possible docker use cases is given at the end of the Dockerfile
  • What's the use-case for the MAKEFILE in the repo root?

Comment thread docker/Dockerfile
FROM python:3.8-slim-buster

WORKDIR pypfopt
COPY pyproject.toml poetry.lock ./

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that only the poetry files are copied initially. These change infrequently (compared to other code). Thus, the dependency installation remains cached by docker, even if other files are changed (much faster builds after the first time).

@robertmartin8

Copy link
Copy Markdown
Collaborator

@phschiele Excellent work!

I think I'll remove the MAKEFILE. It was meant to be an alternative binder deployment, but I don't think we need it anymore.

@robertmartin8
robertmartin8 changed the base branch from master to v1.4.1 February 18, 2021 10:43
@robertmartin8
robertmartin8 merged commit 59ad7fa into PyPortfolio:v1.4.1 Feb 18, 2021
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