This commit is contained in:
parent
78dcca5e1a
commit
acae6f1af4
4 changed files with 38 additions and 7 deletions
21
.drone.yml
Normal file
21
.drone.yml
Normal file
|
@ -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
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
18
beer.py
18
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/<phrase>')
|
||||
def hello(phrase):
|
||||
return phrase
|
||||
|
||||
def main():
|
||||
""" main func """
|
||||
app.run(host='::')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue