convert to fast api
This commit is contained in:
parent
4567653170
commit
0dcb8459a6
@ -9,7 +9,7 @@ RUN cd Cbc-2.9.8 && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install
|
||||
RUN python -m pip install -U Flask
|
||||
RUN python -m pip install fastapi[all]
|
||||
|
||||
# Bundle app source
|
||||
COPY . /app
|
||||
@ -17,4 +17,4 @@ COPY . /app
|
||||
WORKDIR /app/app
|
||||
|
||||
# CMD tail -f /dev/null
|
||||
CMD export FLASK_APP=main && flask run -p 80 --host=0.0.0.0
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
|
||||
|
@ -9,7 +9,8 @@ RUN cd Cbc-2.9.8 && \
|
||||
./configure && \
|
||||
make && \
|
||||
make install
|
||||
RUN python -m pip install -U Flask
|
||||
RUN python -m pip install fastapi[all]
|
||||
|
||||
|
||||
# Bundle app source
|
||||
COPY . /app
|
||||
@ -17,4 +18,4 @@ COPY . /app
|
||||
WORKDIR /app/app
|
||||
|
||||
# CMD tail -f /dev/null
|
||||
CMD export FLASK_APP=main && flask run -p 80 --host=0.0.0.0
|
||||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
|
||||
|
25
app/main.py
25
app/main.py
@ -1,7 +1,22 @@
|
||||
from flask import Flask
|
||||
from fastapi import FastAPI, __version__
|
||||
|
||||
app = Flask(__name__)
|
||||
app = FastAPI()
|
||||
|
||||
@app.route("/")
|
||||
def hello_world():
|
||||
return "<p>Hello, World?</p>"
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {"message": "Welcome to Measures LOFT solver service. v0.1"}
|
||||
|
||||
@app.get("/health")
|
||||
async def health():
|
||||
content = {
|
||||
"maintainer": "Meazure Horizon Team",
|
||||
"git_repo": "https://github.com/yardstick/measure-solver",
|
||||
"server": "OK",
|
||||
"fastapi version": __version__,
|
||||
"app version": "0.1.0"
|
||||
}
|
||||
return content
|
||||
|
||||
@app.get('/ready')
|
||||
async def ready():
|
||||
return 'OK' # just means we're on air
|
||||
|
Loading…
x
Reference in New Issue
Block a user