mirror of
https://github.com/cnlimiter/codex-register.git
synced 2026-05-12 02:21:07 +08:00
feat: 支持 Docker 部署和环境变量配置
- webui.py 支持从环境变量读取配置 (WEBUI_HOST, WEBUI_PORT 等) - 添加 Dockerfile 与 docker-compose.yml 方便本地与容器化部署 - 添加 GitHub Actions 配置,支持推送到 GitHub Container Registry (GHCR)
This commit is contained in:
48
Dockerfile
48
Dockerfile
@@ -1,30 +1,36 @@
|
||||
FROM python:3.10-slim
|
||||
# 使用官方 Python 基础镜像 (使用 slim 版本减小体积)
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements first for better caching
|
||||
# 设置环境变量
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
# WebUI 默认配置
|
||||
WEBUI_HOST=0.0.0.0 \
|
||||
WEBUI_PORT=1455 \
|
||||
LOG_LEVEL=info \
|
||||
DEBUG=0
|
||||
|
||||
# 安装系统依赖
|
||||
# (curl_cffi 等库可能需要编译工具)
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
gcc \
|
||||
python3-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 复制依赖文件并安装
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir --upgrade pip \
|
||||
&& pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Install Python dependencies
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application code
|
||||
# 复制项目代码
|
||||
COPY . .
|
||||
|
||||
# Create data directory
|
||||
RUN mkdir -p data logs
|
||||
# 暴露端口
|
||||
EXPOSE 1455
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
|
||||
# Environment variables
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Run the application
|
||||
# 启动 WebUI
|
||||
CMD ["python", "webui.py"]
|
||||
|
||||
Reference in New Issue
Block a user