| # Multi-stage build for gcli2api | |
| FROM python:3.13-slim as base | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
| TZ=Asia/Shanghai | |
| # Install tzdata and set timezone | |
| # Added: nodejs (for afp.wasm 音频指纹生成), ffmpeg (音频转码) | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| tzdata \ | |
| nodejs \ | |
| ffmpeg \ | |
| && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ | |
| echo "Asia/Shanghai" > /etc/timezone && \ | |
| apt-get clean && \ | |
| rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy only requirements first for better caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy application code | |
| COPY . . | |
| # Expose port | |
| EXPOSE 7861 | |
| # Default command | |
| CMD ["python", "web.py"] |