What's the purpose of this issue?
We have 6 developers contributing to StudyHub at the moment, with 6 different machines with variety of dependencies installed, different OS, ... To ensure we do not run into any problems related to setting up development environment, we need to containerize our backend to avoid "but this works and runs on my machine". See this article: https://devopswithdocker.com/part-2/section-4
Containerization of development environment also allows us to mirror production as much as possible to avoid unexpected issue showing up when deploying, despite everything working well during development. We will use Docker for containerization, everyone would needs to install Docker desktop on their machine.
Side Note
You must use the requirements.old.txt
file, bad name I know but the current requirements.txt
has too much unused libraries in there that will make the Docker image heavier than needed. If requirements.old.txt
does not contain all requirements needed, then I shall pray to GPT the Revered God
You must always run Flask related command in the container, you can use Docker Desktop for this, or use docker compose
(how to do this can be easily found by Google)
Instructions can be found in the useful resources below
Code Complete
- I can start the development environment with just one command, something like:
docker compose up -d --build -f docker-compose.dev.yaml
- The Flask server as well as development database should be setup
Checklist
Related Issues
Useful resources
https://www.freecodecamp.org/news/how-to-dockerize-a-flask-app/
https://medium.com/@lassebenninga/how-to-debug-flask-running-in-docker-compose-in-vs-code-ef37f0f516ee