Skip to content

Improve Dockerfile: dependencies are installed within with hard-coded versions #154

@lsulak

Description

@lsulak

Description of Technical Debt

This is unsustainable, every time we make a change into the codebase by adding a new Python dependency, we have to also update requirements file and also Dockerfile. This is and will be source of problems. Besides, it's not common practice and it leads us to have different env on localhost, CI, CD, and dockerfile / production.

The solution is to:

  • Split the current requirements.txt file into two: requirements.txt (containing depenendies needed for production run of the application) and requirements-dev.txt (containing dependencies needed for CI and tests only - things like black, pytest, pylint etc)
  • Install the requirements.txt only from within the Dockerfile by verifying that the copy of this file exists on the docker image and that something like pip install -r requirements.txt is executed
  • Also, make sure that requirements.txt has dependencies with versions - to generate it, run command pip freeze

Impact of Technical Debt

  • Slows down deployments
  • Increases probability and frequency of bugs
  • Adds unnecessary size to the Docker image by adding unnecessary dependencies
  • Produces highly random / non-deterministic environment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions