.PHONY: clean build_img PYTHON_VERSION = 3.8 PYTHON_SUBVERSION = 3.8.12 PYENV_VERSIONS = $(HOME)/.pyenv/versions PYTHON_BIN = $(PYENV_VERSIONS)/$(PYTHON_SUBVERSION)/bin/python$(PYTHON_VERSION) VENV = venv PYTHON_VENV = $(VENV)/bin/python PIP = $(PYTHON_VENV) -m pip PIP_COMPILE = venv/bin/pip-compile IMG_NAME=etl_beam_env all: oci_img .installed_deps build_img: .img_name .img_name: Dockerfile requirements.txt dev-requirements.txt docker build -t $(IMG_NAME) . echo $(IMG_NAME) > $@ .installed_deps: requirements.txt dev-requirements.txt $(PYTHON_VENV) $(PIP) install \ -r requirements.txt \ -r dev-requirements.txt touch $@ requirements.txt: pyproject.toml $(PIP_COMPILE) $(PIP_COMPILE) \ --resolver=backtracking \ --output-file $@ \ $< dev-requirements.txt: pyproject.toml $(PIP_COMPILE) $(PIP_COMPILE) \ --extra=dev \ --resolver=backtracking \ --output-file $@ \ $< $(PIP_COMPILE): $(PYTHON_VENV) $(PIP) install pip-tools $(PYTHON_VENV): $(PYTHON_BIN) virtualenv --python=$^ $(VENV) $(PIP) install --upgrade pip $(PYTHON_BIN): pyenv install $(PYTHON_SUBVERSION) clean: rm -rf *.egg-info venv installed_deps