diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..4aa324b --- /dev/null +++ b/.drone.yml @@ -0,0 +1,21 @@ +kind: pipeline +name: lint + +steps: +- name: pylint + image: python:slim + commands: + - "echo \"==> Pylint ...\"" + - pip install -r requirements.txt + - pip install pylint + - pylint *.py + +- name: dockerlint + image: hadolint/hadolint + commands: + - hadolint --ignore DL3013 Dockerfile # ignore pinning version in pip + +- name: w3c validator + image: validator/validator:latest + commands: + - vnu static/*.html \ No newline at end of file diff --git a/.gitignore b/.gitignore index 13d1490..153bf17 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ share/python-wheels/ .installed.cfg *.egg MANIFEST +.idea/ # PyInstaller # Usually these files are written by a python script from a template diff --git a/Dockerfile b/Dockerfile index 9787b9e..1af7282 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ FROM python:slim RUN pip install flask COPY beer.py /beer.py +COPY static /static EXPOSE 5000 -CMD python /beer.py +CMD ["python", "/beer.py"] diff --git a/beer.py b/beer.py index 9914bad..1c885fd 100755 --- a/beer.py +++ b/beer.py @@ -1,17 +1,25 @@ #!/usr/bin/env python3.6 # -*- coding:utf-8 -*- +""" stupid countdown beer app to amuse my colleagues and collect buzzwords """ from flask import Flask + +# pylint: disable=invalid-name app = Flask(__name__) + @app.route('/') def index(): - with open('static/beer.html') as f: - data = f.read() + """ main and only app """ + with open('static/beer.html') as html_file: + data = html_file.read() return data -@app.route('/hello/') -def hello(phrase): - return phrase -app.run(host='::') +def main(): + """ main func """ + app.run(host='::') + + +if __name__ == '__main__': + main()