diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..c18adbd --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +*/__pycache__/** +venv +config.toml +config \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ae440c7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.12-slim + +COPY . /auth + +WORKDIR /auth + +RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple + +EXPOSE 8000 + +CMD ["python", "main.py"] diff --git a/config.sample.toml b/config/config.sample.toml similarity index 100% rename from config.sample.toml rename to config/config.sample.toml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..506ed1d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + auth: + build: . + ports: + - "8000:8000" + volumes: + - ./config:/auth/config \ No newline at end of file diff --git a/server/cfg.py b/server/cfg.py index b7d3028..ad32670 100644 --- a/server/cfg.py +++ b/server/cfg.py @@ -1,10 +1,11 @@ import tomllib +import os -with open("config.toml", "rb") as f: +with open("config/config.toml", "rb") as f: config = tomllib.load(f) def reload(): global config - with open("config.toml", "rb") as f: + with open("config/config.toml", "rb") as f: config = tomllib.load(f)