First commit
This commit is contained in:
parent
b298d95aab
commit
f1d46c2555
6 changed files with 41 additions and 0 deletions
15
Dockerfile
Normal file
15
Dockerfile
Normal file
|
@ -0,0 +1,15 @@
|
|||
FROM python:3.12
|
||||
|
||||
MAINTAINER continuist
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip3 install -r requirements.txt
|
||||
|
||||
COPY ./start.py .
|
||||
COPY ./app ./app
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "start:app"]
|
7
app/app.py
Normal file
7
app/app.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return {"Hello": "World"}
|
3
pytest.ini
Normal file
3
pytest.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
[pytest]
|
||||
testpaths = tests
|
||||
pythonpath = .
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
flask
|
||||
gunicorn
|
1
start.py
Normal file
1
start.py
Normal file
|
@ -0,0 +1 @@
|
|||
from app.app import app
|
13
tests/test_app.py
Normal file
13
tests/test_app.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
import pytest
|
||||
from app.app import app
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
app.config['TESTING'] = True
|
||||
with app.test_client() as client:
|
||||
yield client
|
||||
|
||||
def test_index(client):
|
||||
rv = client.get('/')
|
||||
assert rv.status_code == 200
|
||||
assert rv.get_json() == {"Hello": "World"}
|
Loading…
Add table
Reference in a new issue