bumpver/makefile

561 lines
15 KiB
Makefile
Raw Normal View History

2018-11-04 21:34:53 +01:00
# Helpful Links
# http://clarkgrubb.com/makefile-style-guide
# https://explainshell.com
# https://stackoverflow.com/questions/448910
# https://shiroyasha.svbtle.com/escape-sequences-a-quick-guide-1
SHELL := /bin/bash
.SHELLFLAGS := -O extglob -eo pipefail -c
.DEFAULT_GOAL := help
.SUFFIXES:
-include makefile.config.make
PROJECT_DIR := $(notdir $(abspath .))
ifndef DEVELOPMENT_PYTHON_VERSION
DEVELOPMENT_PYTHON_VERSION := python=3.6
endif
ifndef SUPPORTED_PYTHON_VERSIONS
SUPPORTED_PYTHON_VERSIONS := $(DEVELOPMENT_PYTHON_VERSION)
endif
PKG_NAME := $(PACKAGE_NAME)
# TODO (mb 2018-09-23): Support for bash on windows
# perhaps we need to install conda using this
# https://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe
PLATFORM = $(shell uname -s)
# miniconda is shared between projects
2018-12-05 09:42:26 +01:00
CONDA_ROOT := $(shell if [[ -d /opt/conda/envs ]]; then echo "/opt/conda"; else echo "$$HOME/miniconda3"; fi;)
2018-11-04 21:34:53 +01:00
CONDA_BIN := $(CONDA_ROOT)/bin/conda
ENV_PREFIX := $(CONDA_ROOT)/envs
DEV_ENV_NAME := \
2018-12-06 15:35:44 +01:00
$(subst pypy,$(PKG_NAME)_pypy,$(subst python=,$(PKG_NAME)_py,$(subst .,,$(DEVELOPMENT_PYTHON_VERSION))))
2018-11-04 21:34:53 +01:00
CONDA_ENV_NAMES := \
2018-12-06 15:35:44 +01:00
$(subst pypy,$(PKG_NAME)_pypy,$(subst python=,$(PKG_NAME)_py,$(subst .,,$(SUPPORTED_PYTHON_VERSIONS))))
2018-11-04 21:34:53 +01:00
CONDA_ENV_PATHS := \
2019-02-14 23:19:18 +01:00
$(subst pypy,$(ENV_PREFIX)/$(PKG_NAME)_pypy,$(subst python=,$(ENV_PREFIX)/$(PKG_NAME)_py,$(subst .,,$(SUPPORTED_PYTHON_VERSIONS))))
2018-12-06 15:35:44 +01:00
2019-02-15 20:11:34 +01:00
# envname/bin/python is unfortunately not always the correct
# interpreter. In the case of pypy it is either envname/bin/pypy or
# envname/bin/pypy3
2019-02-15 19:57:18 +01:00
CONDA_ENV_BIN_PYTHON_PATHS := \
$(shell echo "$(CONDA_ENV_PATHS)" \
| sed 's!\(_py[[:digit:]]\+\)!\1/bin/python!g' \
| sed 's!\(_pypy2[[:digit:]]\)!\1/bin/pypy!g' \
| sed 's!\(_pypy3[[:digit:]]\)!\1/bin/pypy3!g' \
)
2019-02-14 23:19:18 +01:00
empty :=
literal_space := $(empty) $(empty)
2018-12-05 09:42:26 +01:00
BDIST_WHEEL_PYTHON_TAG := \
$(subst python,py,$(subst $(literal_space),.,$(subst .,,$(subst =,,$(SUPPORTED_PYTHON_VERSIONS)))))
SDIST_FILE_CMD = ls -1t dist/*.tar.gz | head -n 1
BDIST_WHEEL_FILE_CMD = ls -1t dist/*.whl | head -n 1
2018-11-04 21:34:53 +01:00
# default version for development
DEV_ENV := $(ENV_PREFIX)/$(DEV_ENV_NAME)
DEV_ENV_PY := $(DEV_ENV)/bin/python
2019-02-14 23:19:18 +01:00
RSA_KEY_PATH := $(HOME)/.ssh/$(PKG_NAME)_gitlab_runner_id_rsa
2018-11-09 19:22:17 +01:00
2018-12-06 14:21:21 +01:00
DOCKER_BASE_IMAGE := registry.gitlab.com/mbarkhau/pycalver/base
2019-02-14 23:19:18 +01:00
GIT_HEAD_REV = $(shell git rev-parse --short HEAD)
DOCKER_IMAGE_VERSION = $(shell date -u +'%Y%m%dt%H%M%S')_$(GIT_HEAD_REV)
2018-12-06 14:21:21 +01:00
2019-07-23 20:35:59 +02:00
MAX_LINE_LEN = $(shell grep 'max-line-length' setup.cfg | sed 's/[^0-9]{1,}//')
2019-07-23 20:19:42 +02:00
2018-11-04 21:34:53 +01:00
build/envs.txt: requirements/conda.txt
2018-11-05 00:18:49 +01:00
@mkdir -p build/;
2018-11-04 21:34:53 +01:00
@if [[ ! -f $(CONDA_BIN) ]]; then \
2018-11-05 00:18:49 +01:00
echo "installing miniconda ..."; \
2018-11-04 21:34:53 +01:00
if [[ $(PLATFORM) == "Linux" ]]; then \
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" \
2018-11-05 00:18:49 +01:00
> build/miniconda3.sh; \
elif [[ $(PLATFORM) == "MINGW64_NT-10.0" ]]; then \
2018-11-04 21:34:53 +01:00
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh" \
2018-11-05 00:18:49 +01:00
> build/miniconda3.sh; \
elif [[ $(PLATFORM) == "Darwin" ]]; then \
2018-11-04 21:34:53 +01:00
curl "https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh" \
2018-11-05 00:18:49 +01:00
> build/miniconda3.sh; \
fi; \
2018-11-04 21:34:53 +01:00
bash build/miniconda3.sh -b -p $(CONDA_ROOT); \
rm build/miniconda3.sh; \
fi
rm -f build/envs.txt.tmp;
@SUPPORTED_PYTHON_VERSIONS="$(SUPPORTED_PYTHON_VERSIONS)" \
CONDA_ENV_NAMES="$(CONDA_ENV_NAMES)" \
CONDA_ENV_PATHS="$(CONDA_ENV_PATHS)" \
2019-02-15 19:57:18 +01:00
CONDA_ENV_BIN_PYTHON_PATHS="$(CONDA_ENV_BIN_PYTHON_PATHS)" \
2018-11-04 21:34:53 +01:00
CONDA_BIN="$(CONDA_BIN)" \
bash scripts/setup_conda_envs.sh;
$(CONDA_BIN) env list \
| grep $(PKG_NAME) \
| rev | cut -d " " -f1 \
| rev | sort >> build/envs.txt.tmp;
mv build/envs.txt.tmp build/envs.txt;
build/deps.txt: build/envs.txt requirements/*.txt
2018-11-05 00:18:49 +01:00
@mkdir -p build/;
2018-11-04 21:34:53 +01:00
@SUPPORTED_PYTHON_VERSIONS="$(SUPPORTED_PYTHON_VERSIONS)" \
CONDA_ENV_NAMES="$(CONDA_ENV_NAMES)" \
CONDA_ENV_PATHS="$(CONDA_ENV_PATHS)" \
2019-02-15 19:57:18 +01:00
CONDA_ENV_BIN_PYTHON_PATHS="$(CONDA_ENV_BIN_PYTHON_PATHS)" \
2018-11-04 21:34:53 +01:00
CONDA_BIN="$(CONDA_BIN)" \
bash scripts/update_conda_env_deps.sh;
@echo "updating $(DEV_ENV_NAME) development deps ...";
@$(DEV_ENV_PY) -m pip install \
--disable-pip-version-check --upgrade \
--requirement=requirements/integration.txt;
@$(DEV_ENV_PY) -m pip install \
--disable-pip-version-check --upgrade \
--requirement=requirements/development.txt;
@echo "updating local vendor dep copies ...";
@$(DEV_ENV_PY) -m pip install \
--upgrade --disable-pip-version-check \
--no-deps --target=./vendor \
--requirement=requirements/vendor.txt;
@rm -f build/deps.txt.tmp;
2019-02-15 19:57:18 +01:00
@for env_py in $(CONDA_ENV_BIN_PYTHON_PATHS); do \
printf "\n# pip freeze for $${env_py}:\n" >> build/deps.txt.tmp; \
2018-11-04 21:34:53 +01:00
$${env_py} -m pip freeze >> build/deps.txt.tmp; \
printf "\n\n" >> build/deps.txt.tmp; \
done
@mv build/deps.txt.tmp build/deps.txt
2018-12-05 09:42:26 +01:00
## Short help message for each task.
2018-11-04 21:34:53 +01:00
.PHONY: help
help:
@awk '{ \
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
helpCommand = substr($$0, index($$0, ":") + 2); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
2018-12-05 09:42:26 +01:00
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
helpCommand = substr($$0, 0, index($$0, ":")); \
2018-11-04 21:34:53 +01:00
if (helpMessage) { \
2018-12-05 09:42:26 +01:00
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^##/) { \
if (! (helpMessage)) { \
2018-11-04 21:34:53 +01:00
helpMessage = substr($$0, 3); \
} \
} else { \
if (helpMessage) { \
2018-12-05 09:42:26 +01:00
print " "helpMessage \
2018-11-04 21:34:53 +01:00
} \
helpMessage = ""; \
} \
}' \
$(MAKEFILE_LIST)
@if [[ ! -f $(DEV_ENV_PY) ]]; then \
echo "Missing python interpreter at $(DEV_ENV_PY) !"; \
echo "You problably want to install first:"; \
echo ""; \
echo " make install"; \
echo ""; \
exit 0; \
fi
@if [[ ! -f $(CONDA_BIN) ]]; then \
echo "No conda installation found!"; \
echo "You problably want to install first:"; \
echo ""; \
echo " make install"; \
echo ""; \
exit 0; \
fi
2018-12-05 09:42:26 +01:00
## Full help message for each task.
2019-02-14 23:19:18 +01:00
.PHONY: helpverbose
helpverbose:
2018-12-05 09:42:26 +01:00
@printf "Available make targets for \033[97m$(PKG_NAME)\033[0m:\n";
@awk '{ \
if ($$0 ~ /^.PHONY: [a-zA-Z\-\_0-9]+$$/) { \
helpCommand = substr($$0, index($$0, ":") + 2); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^[a-zA-Z\-\_0-9.]+:/) { \
helpCommand = substr($$0, 0, index($$0, ":")); \
if (helpMessage) { \
printf "\033[36m%-20s\033[0m %s\n", \
helpCommand, helpMessage; \
helpMessage = ""; \
} \
} else if ($$0 ~ /^##/) { \
if (helpMessage) { \
helpMessage = helpMessage"\n "substr($$0, 3); \
} else { \
helpMessage = substr($$0, 3); \
} \
} else { \
if (helpMessage) { \
print "\n "helpMessage"\n" \
} \
helpMessage = ""; \
} \
}' \
$(MAKEFILE_LIST)
2018-11-04 21:34:53 +01:00
## -- Project Setup --
## Delete conda envs and cache 💩
.PHONY: clean
clean:
@for env_name in $(CONDA_ENV_NAMES); do \
2019-02-14 23:19:18 +01:00
env_py="$(ENV_PREFIX)/$${env_name}/bin/python"; \
2018-11-04 21:34:53 +01:00
if [[ -f $${env_py} ]]; then \
$(CONDA_BIN) env remove --name $${env_name} --yes; \
fi; \
done
rm -f build/envs.txt
rm -f build/deps.txt
rm -rf vendor/
rm -rf .mypy_cache/
rm -rf .pytest_cache/
rm -rf __pycache__/
rm -rf src/__pycache__/
rm -rf vendor/__pycache__/
@printf "\n setup/update completed ✨ 🍰 ✨ \n\n"
2018-11-09 19:22:17 +01:00
## Force update of dependencies by removing marker files
## Use this when you know an external dependency was
## updated, but that is not reflected in your
## requirements files.
##
## Usage: make force update
2018-11-04 21:34:53 +01:00
.PHONY: force
force:
rm -f build/envs.txt
rm -f build/deps.txt
rm -rf vendor/
rm -rf .mypy_cache/
rm -rf .pytest_cache/
rm -rf __pycache__/
rm -rf src/__pycache__/
rm -rf vendor/__pycache__/
## Setup python virtual environments
.PHONY: install
install: build/deps.txt
## Update dependencies (pip install -U ...)
.PHONY: update
update: build/deps.txt
## Install git pre-push hooks
.PHONY: git_hooks
git_hooks:
2019-02-14 23:19:18 +01:00
@rm -f "$(PWD)/.git/hooks/pre-push"
ln -s "$(PWD)/scripts/pre-push-hook.sh" "$(PWD)/.git/hooks/pre-push"
2018-11-04 21:34:53 +01:00
2018-12-05 09:42:26 +01:00
## -- Integration --
2018-11-04 21:34:53 +01:00
## Run flake8 linter
.PHONY: lint
lint:
@printf "flake8 ..\n"
@$(DEV_ENV)/bin/flake8 src/
@printf "\e[1F\e[9C ok\n"
2019-07-23 20:31:20 +02:00
2019-07-23 20:19:42 +02:00
@printf "sjfmt ..\n"
@$(DEV_ENV)/bin/sjfmt \
--target-version=py36 \
--skip-string-normalization \
--line-length=$(MAX_LINE_LEN) \
--check \
src/ test/ 2>&1 | sed "/All done/d" | sed "/left unchanged/d"
@printf "\e[1F\e[9C ok\n"
2018-11-04 21:34:53 +01:00
## Run mypy type checker
.PHONY: mypy
mypy:
@rm -rf ".mypy_cache";
@printf "mypy ....\n"
2019-01-07 15:03:16 +01:00
@MYPYPATH=stubs/:vendor/ $(DEV_ENV_PY) -m mypy \
--html-report mypycov \
src/ | sed "/Generated HTML report/d"
2018-11-04 21:34:53 +01:00
@printf "\e[1F\e[9C ok\n"
## Run pylint. Should not break the build yet
.PHONY: pylint
pylint:
@printf "pylint ..\n";
@$(DEV_ENV)/bin/pylint --jobs=4 --output-format=colorized --score=no \
--disable=C0103,C0301,C0330,C0326,C0330,C0411,R0903,W1619,W1618,W1203 \
--extension-pkg-whitelist=ujson,lxml,PIL,numpy,pandas,sklearn,pyblake2 \
src/
@$(DEV_ENV)/bin/pylint --jobs=4 --output-format=colorized --score=no \
--disable=C0103,C0111,C0301,C0330,C0326,C0330,C0411,R0903,W1619,W1618,W1203 \
--extension-pkg-whitelist=ujson,lxml,PIL,numpy,pandas,sklearn,pyblake2 \
test/
@printf "\e[1F\e[9C ok\n"
## Run pytest unit and integration tests
.PHONY: test
2018-12-09 16:00:48 +01:00
test:
2018-11-04 21:34:53 +01:00
@rm -rf ".pytest_cache";
@rm -rf "src/__pycache__";
@rm -rf "test/__pycache__";
2018-12-05 09:42:26 +01:00
# First we test the local source tree using the dev environment
2018-11-22 17:45:56 +01:00
ENV=$${ENV-dev} PYTHONPATH=src/:vendor/:$$PYTHONPATH \
$(DEV_ENV_PY) -m pytest -v \
--doctest-modules \
2018-12-05 09:42:26 +01:00
--verbose \
2018-11-22 17:45:56 +01:00
--cov-report html \
--cov-report term \
2018-12-05 09:42:26 +01:00
$(shell cd src/ && ls -1 */__init__.py | awk '{ print "--cov "substr($$1,0,index($$1,"/")-1) }') \
2018-11-22 17:45:56 +01:00
test/ src/;
2018-12-05 09:42:26 +01:00
2018-11-04 21:34:53 +01:00
@rm -rf ".pytest_cache";
@rm -rf "src/__pycache__";
@rm -rf "test/__pycache__";
## -- Helpers --
2018-12-05 09:42:26 +01:00
## Run code formatter on src/ and test/
.PHONY: fmt
fmt:
2019-07-09 08:22:54 +02:00
@$(DEV_ENV)/bin/sjfmt \
--target-version=py36 \
--skip-string-normalization \
2019-07-23 20:19:42 +02:00
--line-length=$(MAX_LINE_LEN) \
2018-12-05 09:42:26 +01:00
src/ test/
2019-02-14 23:19:18 +01:00
## Shortcut for make fmt lint mypy test
2018-11-04 21:34:53 +01:00
.PHONY: check
check: fmt lint mypy test
2018-12-05 09:42:26 +01:00
## Start subshell with environ variables set.
.PHONY: env_subshell
env_subshell:
2018-11-05 00:18:49 +01:00
@bash --init-file <(echo '\
source $$HOME/.bashrc; \
2018-12-06 14:21:21 +01:00
source $(CONDA_ROOT)/etc/profile.d/conda.sh \
2018-11-22 16:45:04 +00:00
export ENV=$${ENV-dev}; \
2018-11-05 00:18:49 +01:00
export PYTHONPATH="src/:vendor/:$$PYTHONPATH"; \
conda activate $(DEV_ENV_NAME) \
')
2018-11-04 21:34:53 +01:00
2019-02-14 23:19:18 +01:00
## Usage: "source ./activate", to deactivate: "deactivate"
2018-12-05 09:42:26 +01:00
.PHONY: activate
activate:
@echo 'source $(CONDA_ROOT)/etc/profile.d/conda.sh;'
@echo 'if [[ -z $$ENV ]]; then'
2019-02-14 23:19:18 +01:00
@echo ' export _env_before_activate=$${ENV};'
2018-12-05 09:42:26 +01:00
@echo 'fi'
@echo 'if [[ -z $$PYTHONPATH ]]; then'
2019-02-14 23:19:18 +01:00
@echo ' export _pythonpath_before_activate=$${PYTHONPATH};'
2018-12-05 09:42:26 +01:00
@echo 'fi'
@echo 'export ENV=$${ENV-dev};'
@echo 'export PYTHONPATH="src/:vendor/:$$PYTHONPATH";'
@echo 'conda activate $(DEV_ENV_NAME);'
@echo 'function deactivate {'
2019-02-14 23:19:18 +01:00
@echo ' if [[ -z $${_env_before_activate} ]]; then'
@echo ' export ENV=$${_env_before_activate}; '
2018-12-05 09:42:26 +01:00
@echo ' else'
@echo ' unset ENV;'
@echo ' fi'
2019-02-14 23:19:18 +01:00
@echo ' if [[ -z $${_pythonpath_before_activate} ]]; then'
@echo ' export PYTHONPATH=$${_pythonpath_before_activate}; '
2018-12-05 09:42:26 +01:00
@echo ' else'
@echo ' unset PYTHONPATH;'
@echo ' fi'
@echo ' conda deactivate;'
@echo '};'
2018-11-04 21:34:53 +01:00
## Drop into an ipython shell with correct env variables set
.PHONY: ipy
ipy:
2018-11-22 16:45:04 +00:00
@ENV=$${ENV-dev} PYTHONPATH=src/:vendor/:$$PYTHONPATH \
2018-11-04 21:34:53 +01:00
$(DEV_ENV)/bin/ipython
## Like `make test`, but with debug parameters
.PHONY: devtest
devtest:
@rm -rf "src/__pycache__";
@rm -rf "test/__pycache__";
2018-12-05 09:42:26 +01:00
ifdef FILTER
2018-11-22 16:45:04 +00:00
ENV=$${ENV-dev} PYTHONPATH=src/:vendor/:$$PYTHONPATH \
2018-11-04 21:34:53 +01:00
$(DEV_ENV_PY) -m pytest -v \
--doctest-modules \
--no-cov \
--verbose \
--capture=no \
--exitfirst \
2019-07-10 09:42:53 +02:00
--failed-first \
2018-12-05 09:42:26 +01:00
-k $(FILTER) \
2018-11-04 21:34:53 +01:00
test/ src/;
else
2018-11-22 16:45:04 +00:00
ENV=$${ENV-dev} PYTHONPATH=src/:vendor/:$$PYTHONPATH \
2018-11-04 21:34:53 +01:00
$(DEV_ENV_PY) -m pytest -v \
--doctest-modules \
--no-cov \
--verbose \
--capture=no \
--exitfirst \
2019-07-10 09:42:53 +02:00
--failed-first \
2018-11-04 21:34:53 +01:00
test/ src/;
endif
@rm -rf "src/__pycache__";
@rm -rf "test/__pycache__";
2018-12-21 20:34:30 +01:00
## Run `make lint mypy test` using docker
.PHONY: citest
citest:
docker build --file Dockerfile --tag tmp_citest_$(PKG_NAME) .
2018-12-21 20:50:32 +01:00
docker run --tty tmp_citest_$(PKG_NAME) make lint mypy test test_compat
2018-12-21 20:34:30 +01:00
2018-11-04 21:34:53 +01:00
## -- Build/Deploy --
2018-12-05 09:42:26 +01:00
# Generate Documentation
2018-11-09 19:22:17 +01:00
# .PHONY: doc
# doc:
# echo "Not Implemented"
2018-11-04 21:34:53 +01:00
2018-11-09 19:22:17 +01:00
## Freeze dependencies of the current development env.
## The requirements files this produces should be used
## in order to have reproducable builds, otherwise you
## should minimize the number of pinned versions in
## your requirements.
2018-12-05 09:42:26 +01:00
.PHONY: freeze
freeze:
$(DEV_ENV_PY) -m pip freeze \
> requirements/$(shell date -u +"%Y%m%dt%H%M%S")_freeze.txt
2018-11-04 21:34:53 +01:00
2018-12-05 09:42:26 +01:00
## Bump Version number in all files
.PHONY: bump_version
bump_version:
2018-12-22 09:51:14 +01:00
$(DEV_ENV)/bin/pycalver bump;
2018-12-05 09:42:26 +01:00
## Create python sdist and bdist_wheel files
2019-02-16 17:20:34 +01:00
.PHONY: dist_build
dist_build:
2018-12-05 09:42:26 +01:00
$(DEV_ENV_PY) setup.py sdist;
2019-02-22 10:44:03 +01:00
$(DEV_ENV_PY) setup.py bdist_wheel --python-tag=py2.py3;
2019-02-14 23:19:18 +01:00
@rm -rf src/*.egg-info
2018-12-05 09:42:26 +01:00
## Upload sdist and bdist files to pypi
2019-02-16 17:20:34 +01:00
.PHONY: dist_upload
dist_upload:
2018-12-05 09:42:26 +01:00
@if [[ "1" != "1" ]]; then \
echo "FAILSAFE! Not publishing a private package."; \
echo " To avoid this set IS_PUBLIC=1 in bootstrap.sh and run it."; \
exit 1; \
fi
$(DEV_ENV)/bin/twine check $$($(SDIST_FILE_CMD));
$(DEV_ENV)/bin/twine check $$($(BDIST_WHEEL_FILE_CMD));
$(DEV_ENV)/bin/twine upload $$($(SDIST_FILE_CMD)) $$($(BDIST_WHEEL_FILE_CMD));
2019-02-16 17:20:34 +01:00
## bump_version dist_build dist_upload
.PHONY: dist_publish
dist_publish: bump_version dist_build dist_upload
2018-11-04 21:34:53 +01:00
## Build docker images. Must be run when dependencies are added
## or updated. The main reasons this can fail are:
2019-02-14 23:19:18 +01:00
## 1. No ssh key at $(HOME)/.ssh/$(PKG_NAME)_gitlab_runner_id_rsa
2018-11-04 21:34:53 +01:00
## (which is needed to install packages from private repos
## and is copied into a temp container during the build).
2018-11-09 19:22:17 +01:00
## 2. Your docker daemon is not running
## 3. You're using WSL and docker is not exposed on tcp://localhost:2375
## 4. You're using WSL but didn't do export DOCKER_HOST="tcp://localhost:2375"
2019-02-14 23:33:20 +01:00
.PHONY: docker_build
docker_build:
2019-02-14 23:19:18 +01:00
@if [[ -f "$(RSA_KEY_PATH)" ]]; then \
2018-11-04 21:34:53 +01:00
docker build \
2019-02-14 23:19:18 +01:00
--build-arg SSH_PRIVATE_RSA_KEY="$$(cat '$(RSA_KEY_PATH)')" \
2018-11-04 21:34:53 +01:00
--file docker_base.Dockerfile \
2018-12-06 14:21:21 +01:00
--tag $(DOCKER_BASE_IMAGE):$(DOCKER_IMAGE_VERSION) \
2018-12-05 09:42:26 +01:00
--tag $(DOCKER_BASE_IMAGE) \
2018-11-05 00:18:49 +01:00
.; \
else \
2018-11-04 21:34:53 +01:00
docker build \
--file docker_base.Dockerfile \
2018-12-06 14:21:21 +01:00
--tag $(DOCKER_BASE_IMAGE):$(DOCKER_IMAGE_VERSION) \
2018-12-05 09:42:26 +01:00
--tag $(DOCKER_BASE_IMAGE) \
2018-11-05 00:18:49 +01:00
.; \
2018-11-04 21:34:53 +01:00
fi
2018-12-05 09:42:26 +01:00
docker push $(DOCKER_BASE_IMAGE)
2018-11-04 21:34:53 +01:00
2018-12-05 09:42:26 +01:00
## -- Extra/Custom/Project Specific Tasks --
2018-11-04 21:34:53 +01:00
-include makefile.extra.make