| # Copyright 2020-present Open Networking Foundation |
| # |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| # Secret iCal URL for ACE downtime calendar |
| SECRET_ICAL_URL ?= |
| |
| # Namespace to install secret in, for testing |
| NAMESPACE ?= edge-monitoring |
| |
| # set default shell |
| SHELL = bash -e -o pipefail |
| |
| # Variables |
| VERSION ?= $(shell cat ../VERSION) |
| VENVDIR := venv |
| |
| ## Docker related |
| DOCKER_REGISTRY ?= |
| DOCKER_REPOSITORY ?= |
| DOCKER_BUILD_ARGS ?= |
| DOCKER_TAG ?= ${VERSION} |
| ADAPTER_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}edge-monitoring-server:${DOCKER_TAG} |
| |
| |
| # This should to be the first and default target in this Makefile |
| help: |
| @echo "Usage: make [<target>]" |
| @echo "where available targets are:" |
| @echo |
| @echo "build : Build the edge-monitoring-server docker image" |
| @echo "help : Print this help" |
| @echo "docker-push : Push the docker image to an external repository" |
| @echo "venv : Build local Python virtualenv" |
| @echo "test : Run edge-monitoring-server unit tests" |
| @echo "clean : Remove files created by the build and tests" |
| @echo "distclean : Remove venv directory" |
| @echo |
| |
| build: docker-build |
| |
| docker-build: |
| docker build $(DOCKER_BUILD_ARGS) \ |
| -t ${ADAPTER_IMAGENAME} \ |
| -f ./Dockerfile.server . |
| |
| docker-push: |
| docker push ${ADAPTER_IMAGENAME} |
| |
| ${VENVDIR}: requirements.txt |
| python3 -m venv ${VENVDIR};\ |
| source ./${VENVDIR}/bin/activate ; set -u ;\ |
| pip install --upgrade pip wheel setuptools;\ |
| python3 --version; pip --version; \ |
| pip install -r requirements.txt |
| |
| clean: |
| find . -name '*.pyc' | xargs rm -f |
| |
| distclean: clean |
| rm -rf ${VENVDIR} |
| |
| test: venv |
| source ./${VENVDIR}/bin/activate ; set -u ;\ |
| python3 test_edge_monitoring_server.py |