diff --git a/Dockerfile b/Dockerfile index fe5056c..474aca3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,4 @@ RUN pip3 install --no-cache-dir --upgrade -r /starlio-web/requirements.txt COPY ./ /starlio-web/ -CMD ["fastapi", "run", "main.py", "--port", "8000"] \ No newline at end of file +CMD ["python", "main.py"] \ No newline at end of file diff --git a/main.py b/main.py index 1a03f90..55cef12 100644 --- a/main.py +++ b/main.py @@ -1,6 +1,8 @@ from fastapi.staticfiles import StaticFiles from starlette.responses import FileResponse from fastapi import FastAPI +import uvicorn +import os from src.routes import index from src.routes import wallpaper @@ -14,12 +16,12 @@ app.mount('/static/', StaticFiles(directory='./src/web/static/')) app.mount('/.well-known/', StaticFiles(directory='./.well-known/')) -@app.route('/app-ads.txt') +@app.get('/app-ads.txt') async def app_ads(req): return FileResponse('./app-ads.txt') -@app.route('/robots.txt') +@app.get('/robots.txt') async def robots_txt(req): return FileResponse('./robots.txt') @@ -27,3 +29,6 @@ async def robots_txt(req): @app.exception_handler(404) async def not_found(req, __): return FileResponse('./src/web/html/error/404.html') + +if __name__ == '__main__': + uvicorn.run(app, host="0.0.0.0", port=int(os.environ['PORT'])) diff --git a/requirements.txt b/requirements.txt index ee7bc2d..d72ab2a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ fastapi[standard]~=0.111.0 requests~=2.32.0 -starlette~=0.37.2 \ No newline at end of file +starlette~=0.37.2 +uvicorn~=0.31.0 \ No newline at end of file