2018-12-22 15:08:04 +00:00
|
|
|
SHELL := /bin/bash
|
|
|
|
|
|
|
|
NS ?= abhinavsingh
|
|
|
|
IMAGE_NAME ?= proxy.py
|
2019-08-24 17:23:30 +00:00
|
|
|
VERSION ?= v$(shell python proxy.py --version)
|
2019-02-09 05:13:34 +00:00
|
|
|
LATEST_TAG := $(NS)/$(IMAGE_NAME):latest
|
2018-12-22 15:08:04 +00:00
|
|
|
IMAGE_TAG := $(NS)/$(IMAGE_NAME):$(VERSION)
|
|
|
|
|
2019-09-25 02:02:57 +00:00
|
|
|
HTTPS_KEY_FILE_PATH := https-key.pem
|
|
|
|
HTTPS_CERT_FILE_PATH := https-cert.pem
|
|
|
|
|
|
|
|
CA_KEY_FILE_PATH := ca-key.pem
|
|
|
|
CA_CERT_FILE_PATH := ca-cert.pem
|
|
|
|
CA_SIGNING_KEY_FILE_PATH := ca-signing-key.pem
|
|
|
|
|
2019-09-25 22:51:12 +00:00
|
|
|
.PHONY: all clean test package test-release release coverage lint autopep8
|
2019-09-25 02:02:57 +00:00
|
|
|
.PHONY: container run-container release-container https-certificates ca-certificates
|
2013-12-23 21:51:45 +00:00
|
|
|
|
|
|
|
all: clean test
|
|
|
|
|
|
|
|
clean:
|
|
|
|
find . -name '*.pyc' -exec rm -f {} +
|
|
|
|
find . -name '*.pyo' -exec rm -f {} +
|
|
|
|
find . -name '*~' -exec rm -f {} +
|
2018-12-22 20:43:17 +00:00
|
|
|
rm -f .coverage
|
|
|
|
rm -rf htmlcov
|
2019-02-09 02:57:44 +00:00
|
|
|
rm -rf dist
|
2013-12-23 21:51:45 +00:00
|
|
|
|
|
|
|
test:
|
2019-09-02 18:20:26 +00:00
|
|
|
python -m unittest tests
|
2013-12-23 21:51:45 +00:00
|
|
|
|
2019-02-09 02:57:44 +00:00
|
|
|
package: clean
|
|
|
|
python setup.py sdist bdist_wheel
|
2013-12-23 21:51:45 +00:00
|
|
|
|
2019-02-09 02:57:44 +00:00
|
|
|
test-release: package
|
|
|
|
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
|
2018-12-22 15:08:04 +00:00
|
|
|
|
2019-02-09 02:57:44 +00:00
|
|
|
release: package
|
|
|
|
twine upload dist/*
|
|
|
|
|
|
|
|
coverage:
|
2019-08-25 17:31:42 +00:00
|
|
|
coverage3 run tests.py
|
|
|
|
coverage3 html
|
2019-08-24 18:31:55 +00:00
|
|
|
open htmlcov/index.html
|
2018-12-22 20:43:17 +00:00
|
|
|
|
2019-09-17 03:18:14 +00:00
|
|
|
lint:
|
2019-09-25 22:51:12 +00:00
|
|
|
mypy --strict --ignore-missing-imports proxy.py plugin_examples.py tests.py
|
|
|
|
flake8 --ignore=E501,W504 proxy.py
|
|
|
|
flake8 --ignore=E501,W504 tests.py
|
|
|
|
|
|
|
|
autopep8:
|
2019-09-25 02:02:57 +00:00
|
|
|
autopep8 --recursive --in-place --aggressive proxy.py
|
|
|
|
autopep8 --recursive --in-place --aggressive tests.py
|
|
|
|
autopep8 --recursive --in-place --aggressive plugin_examples.py
|
2018-12-22 20:43:17 +00:00
|
|
|
|
2019-02-09 02:57:44 +00:00
|
|
|
container:
|
2019-02-09 05:13:34 +00:00
|
|
|
docker build -t $(LATEST_TAG) -t $(IMAGE_TAG) .
|
|
|
|
|
|
|
|
run-container:
|
|
|
|
docker run -it -p 8899:8899 --rm $(LATEST_TAG)
|
|
|
|
|
|
|
|
release-container:
|
|
|
|
docker push $(IMAGE_TAG)
|
2019-09-25 02:02:57 +00:00
|
|
|
|
|
|
|
https-certificates:
|
2019-09-25 22:51:12 +00:00
|
|
|
# Generate server key
|
2019-09-25 02:02:57 +00:00
|
|
|
openssl genrsa -out $(HTTPS_KEY_FILE_PATH) 2048
|
|
|
|
# Generate server certificate
|
|
|
|
openssl req -new -x509 -days 3650 -key $(HTTPS_KEY_FILE_PATH) -out $(HTTPS_CERT_FILE_PATH)
|
|
|
|
|
|
|
|
ca-certificates:
|
|
|
|
# Generate CA key
|
|
|
|
openssl genrsa -out $(CA_KEY_FILE_PATH) 2048
|
|
|
|
# Generate CA certificate
|
|
|
|
openssl req -new -x509 -days 3650 -key $(CA_KEY_FILE_PATH) -out $(CA_CERT_FILE_PATH)
|
|
|
|
# Generate key that will be used to generate domain certificates on the fly
|
|
|
|
# Generated certificates are then signed with CA certificate / key generated above
|
|
|
|
openssl genrsa -out $(CA_SIGNING_KEY_FILE_PATH) 2048
|