完成docker

This commit is contained in:
cxykevin 2024-08-25 21:23:24 +08:00
parent 987cd9ec9e
commit c65f0bf66c
5 changed files with 25 additions and 2 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
*/__pycache__/**
venv
config.toml
config

11
Dockerfile Normal file
View File

@ -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"]

7
docker-compose.yml Normal file
View File

@ -0,0 +1,7 @@
services:
auth:
build: .
ports:
- "8000:8000"
volumes:
- ./config:/auth/config

View File

@ -1,10 +1,11 @@
import tomllib import tomllib
import os
with open("config.toml", "rb") as f: with open("config/config.toml", "rb") as f:
config = tomllib.load(f) config = tomllib.load(f)
def reload(): def reload():
global config global config
with open("config.toml", "rb") as f: with open("config/config.toml", "rb") as f:
config = tomllib.load(f) config = tomllib.load(f)