mirror of
https://gitea.tendokyu.moe/Hay1tsme/artemis.git
synced 2026-10-07 09:28:03 +03:00
Merge pull request 'Docker project fixes' (#252) from szy73/artemis:fix/docker into develop
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/252
This commit is contained in:
+4
-4
@@ -1,21 +1,21 @@
|
||||
FROM python:3.9.15-slim-bullseye
|
||||
FROM python:3.14.6-slim-bookworm
|
||||
|
||||
RUN apt update && apt install default-libmysqlclient-dev build-essential libtk nodejs npm pkg-config -y
|
||||
RUN apt update && apt install default-libmysqlclient-dev gcc libmemcached-dev -y
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip3 install -r requirements.txt
|
||||
RUN npm i -g nodemon
|
||||
|
||||
COPY entrypoint.sh entrypoint.sh
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
RUN mkdir logs
|
||||
COPY index.py index.py
|
||||
COPY dbutils.py dbutils.py
|
||||
COPY read.py read.py
|
||||
ADD core core
|
||||
ADD titles titles
|
||||
ADD logs logs
|
||||
ADD cert cert
|
||||
|
||||
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||
|
||||
+3
-3
@@ -25,7 +25,7 @@ import os
|
||||
from os import path, environ, mkdir, access, W_OK
|
||||
|
||||
from .config import CoreConfig
|
||||
from .utils import Utils
|
||||
from .utils import Utils, create_lifespan
|
||||
from .data import Data
|
||||
from .const import *
|
||||
from .title import TitleServlet
|
||||
@@ -1206,7 +1206,7 @@ app_billing = Starlette(
|
||||
Route("/request", billing.handle_billing_request, methods=["POST"]),
|
||||
Route("/request/", billing.handle_billing_request, methods=["POST"]),
|
||||
],
|
||||
on_startup=[billing.startup]
|
||||
lifespan=create_lifespan(billing.startup),
|
||||
)
|
||||
|
||||
allnet = AllnetServlet(cfg, cfg_dir)
|
||||
@@ -1229,5 +1229,5 @@ if cfg.allnet.allow_online_updates:
|
||||
app_allnet = Starlette(
|
||||
cfg.server.is_develop,
|
||||
route_lst,
|
||||
on_startup=[allnet.startup]
|
||||
lifespan=create_lifespan(allnet.startup)
|
||||
)
|
||||
|
||||
@@ -555,6 +555,7 @@ class CoreConfig(dict):
|
||||
if envKey.endswith("_"):
|
||||
envKey = envKey[:-1]
|
||||
|
||||
envKey = envKey.upper()
|
||||
if envKey in os.environ:
|
||||
return os.environ.get(envKey)
|
||||
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ from os import path, environ, mkdir, W_OK, access
|
||||
from core import CoreConfig, Utils
|
||||
from core.data import Data
|
||||
from core.const import AllnetCountryCode
|
||||
from core.utils import create_lifespan
|
||||
|
||||
# A-HJ-NP-Z
|
||||
SERIAL_LETTERS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
|
||||
@@ -1209,4 +1210,4 @@ if not access(cfg.server.log_dir, W_OK):
|
||||
exit(1)
|
||||
|
||||
fe = FrontendServlet(cfg, cfg_dir)
|
||||
app = Starlette(cfg.server.is_develop, fe.get_routes(), on_startup=[fe.startup])
|
||||
app = Starlette(cfg.server.is_develop, fe.get_routes(), lifespan=create_lifespan(fe.startup))
|
||||
|
||||
@@ -6,6 +6,7 @@ from os import walk
|
||||
from types import ModuleType
|
||||
from typing import Any, Dict, Optional
|
||||
import math
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
import jwt
|
||||
from starlette.requests import Request
|
||||
@@ -153,3 +154,12 @@ def decode_sega_auth_key(
|
||||
except Exception as e:
|
||||
logger.error(f"Unknown exception occoured when decoding Sega Auth Key! {e}")
|
||||
return None
|
||||
|
||||
|
||||
def create_lifespan(on_startup):
|
||||
@asynccontextmanager
|
||||
async def lifespan(app):
|
||||
on_startup()
|
||||
yield
|
||||
|
||||
return lifespan
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ services:
|
||||
|
||||
environment:
|
||||
CFG_DEV: 1
|
||||
CFG_CORE_SERVER_LISTEN_ADDRESS: 0.0.0.0
|
||||
CFG_CORE_SERVER_HOSTNAME: 0.0.0.0
|
||||
CFG_CORE_DATABASE_HOST: ma.db
|
||||
CFG_CORE_MEMCACHED_HOSTNAME: ma.memcached
|
||||
@@ -31,7 +32,7 @@ services:
|
||||
|
||||
db:
|
||||
hostname: ma.db
|
||||
image: yobasystems/alpine-mariadb:10.11.5
|
||||
image: yobasystems/alpine-mariadb:11.4.9
|
||||
environment:
|
||||
MYSQL_DATABASE: aime
|
||||
MYSQL_USER: aime
|
||||
|
||||
+2
-2
@@ -2,10 +2,10 @@
|
||||
|
||||
if [[ -z "${CFG_DEV}" ]]; then
|
||||
echo Production mode
|
||||
python3 index.py
|
||||
exec python3 index.py
|
||||
else
|
||||
echo Development mode
|
||||
python3 dbutils.py create
|
||||
nodemon -w aime --legacy-watch index.py
|
||||
exec python3 index.py
|
||||
fi
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ mypy
|
||||
wheel
|
||||
pytz
|
||||
pyyaml
|
||||
sqlalchemy==1.4.46
|
||||
sqlalchemy<2.0
|
||||
aiomysql
|
||||
pyopenssl
|
||||
service_identity
|
||||
|
||||
Reference in New Issue
Block a user