How to Dockerize Your App with a GitHub Module

Published on
1 mins read
--- views

How to dockerize your own app which has external reference as github module? wow

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:

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

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:
install-libs:
	echo "[SCREENPROOF-MODULE/MAKE] install-libs"
	pip install -e <COPY_TO_PATH>