Update Docker configuration to run in Yandex Cloud

This commit is contained in:
Murzify 2024-09-28 13:48:18 +05:00
parent 79849e5de9
commit f656492c5a
3 changed files with 10 additions and 4 deletions

View file

@ -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"]
CMD ["python", "main.py"]

View file

@ -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']))

View file

@ -1,3 +1,4 @@
fastapi[standard]~=0.111.0
requests~=2.32.0
starlette~=0.37.2
uvicorn~=0.31.0