Created
March 25, 2024 07:41
-
-
Save neilmillard/223516b29b666aa2851a4695568f4177 to your computer and use it in GitHub Desktop.
make docker build with version incrementor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
.EXPORT_ALL_VARIABLES: | |
SHELL = /bin/bash | |
VENV_NAME = venv | |
PRODUCT = myapp | |
version=$(shell cat .version) | |
.PHONY: virtualenv | |
virtualenv: | |
pip install virtualenv | |
.PHONY: docker_venv | |
docker_venv: virtualenv | |
virtualenv --python $$(cat .python-version) ${VENV_NAME} | |
@${VENV_NAME}/bin/pip install --upgrade pip | |
@${VENV_NAME}/bin/pip install version_incrementor==1.5.0 | |
@echo "Installed version_incrementor" | |
@touch ${VENV_NAME}/bin/activate | |
@echo "virtualenv prepared, please run 'source ${VENV_NAME}/bin/activate' if you wish to use it in your current shell" | |
.PHONY: docker_authenticate_to_registry | |
docker_authenticate_to_registry: | |
@docker login --username ${REGISTRY_USERNAME} --password "${REGISTRY_PASSWORD}" ${REGISTRY_FQDN} | |
.PHONY: docker_build | |
docker_build: docker_venv | |
@echo "Getting next version" | |
@${VENV_NAME}/bin/prepare-release | |
@docker build -t ${PRODUCT}:$$(cat .version) . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment