diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a617ea4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# 使用官方 Python 镜像(Debian 系) +FROM python:3.8-slim + +# 设置时区为北京时间 +ENV TZ=Asia/Shanghai +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# 安装系统依赖(仅运行时需要的库) +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + libjpeg-dev \ + zlib1g-dev \ + libtiff5-dev \ + libfreetype6-dev \ + liblcms2-dev \ + libwebp-dev \ + && rm -rf /var/lib/apt/lists/* + +# 设置工作目录 +WORKDIR /app + +# 复制依赖文件并安装 +COPY requirements.txt . +RUN pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt + +# 复制应用代码 +COPY . . + +# 暴露端口 +EXPOSE 5000 + +# 运行命令 +CMD ["python", "app.py"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..e8136bb --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3.8' + +services: + tiku_bm: + image: certmanager:latest + container_name: certmanager + ports: + - "5002:5000" + environment: + - FLASK_ENV=production + volumes: + - ./data:/app/data + restart: unless-stopped \ No newline at end of file