How to dockerize your own app which has external reference as github module?
What do we have
- Flask appication
- External lib which is used as a reference
Idea
Add reference repo as a github submodule (for easier work during local development).
Clone repo with submodules recursively:
1 2 |
git submodule update --init --recursive |
As submodules are not included itself into main repository, but only the link, we have to handle this case in github actions worklow manually.
I prefer that way:
- Remove submodules link
- Clone repo passing Personal Access token (in case your repo is private)
Makefile
1 2 3 4 5 6 7 8 9 |
clean: echo "[SCREENPROOF-APP/MAKE] clean" sudo rm -r lib || true sudo rm -r venv || true python3.8 -m venv venv clone-libs: echo "[SCREENPROOF-APP/MAKE] clone-libs" git clone https://<YOUR_PAT>:@github.com/<REPO>.git lib/<COPY_TO_PATH> |
- In Dockerfile, install and link it:
1 2 3 |
install-libs: echo "[SCREENPROOF-MODULE/MAKE] install-libs" pip install -e <COPY_TO_PATH> |