/
Makefile
39 lines (34 loc) · 1.65 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
## The Makefile includes instructions on environment setup and lint tests
# Create and activate a virtual environment
# Install dependencies in requirements.txt
# Dockerfile should pass hadolint
# app.py should pass pylint
# (Optional) Build a simple integration test
setup:
# Create python virtualenv & source it
# source ~/.devops/bin/activate
python3 -m venv ~/.devops
source ~/.devops/bin/activate
install:
# This should be run from inside a virtualenv
pip install --upgrade pip &&\
wget -O ./hadolint https://github.com/hadolint/hadolint/releases/download/v1.16.3/hadolint-Linux-x86_64 &&\
chmod +x ./hadolint &&\
pip install -r requirements.txt
# Above ive Added Install Hadolint:fetch Hadolint and install it in the local directory. Not needed if its installed locally, i.e. global but rqd for proper containerization
# Please make sure that you are installing it in the local directory instead of attempting to install it in the bin folder which will require administrator access
test:
# Additional, optional, tests could go here
#python -m pytest -vv --cov=myrepolib tests/*.py
#python -m pytest --nbval notebook.ipynb
lint:
# See local hadolint install instructions: https://github.com/hadolint/hadolint
# This is linter for Dockerfiles
# hadolint Dockerfile <- for local only
# Since the above command will install hadolint in the current directory I run it below from the current directory
./hadolint Dockerfile
# This is a linter for Python source code linter: https://www.pylint.org/
# This should be run from inside a virtualenv
pylint --disable=R,C,W1203,W1202 app.py
# pylint --disable=R,C, app.py // OR the above
all: install lint test