Merge pull request #1 from Murzify/yandex-cloud

Update Docker configuration to run in Yandex Cloud
This commit is contained in:
Murzify 2024-09-28 13:54:03 +05:00 committed by GitHub
commit 64747c2807
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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/ 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 fastapi.staticfiles import StaticFiles
from starlette.responses import FileResponse from starlette.responses import FileResponse
from fastapi import FastAPI from fastapi import FastAPI
import uvicorn
import os
from src.routes import index from src.routes import index
from src.routes import wallpaper 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.mount('/.well-known/', StaticFiles(directory='./.well-known/'))
@app.route('/app-ads.txt') @app.get('/app-ads.txt')
async def app_ads(req): async def app_ads(req):
return FileResponse('./app-ads.txt') return FileResponse('./app-ads.txt')
@app.route('/robots.txt') @app.get('/robots.txt')
async def robots_txt(req): async def robots_txt(req):
return FileResponse('./robots.txt') return FileResponse('./robots.txt')
@ -27,3 +29,6 @@ async def robots_txt(req):
@app.exception_handler(404) @app.exception_handler(404)
async def not_found(req, __): async def not_found(req, __):
return FileResponse('./src/web/html/error/404.html') 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 fastapi[standard]~=0.111.0
requests~=2.32.0 requests~=2.32.0
starlette~=0.37.2 starlette~=0.37.2
uvicorn~=0.31.0