2api / Dockerfile
lin7zhi's picture
Upload Dockerfile
f453ca3 verified
raw
history blame contribute delete
963 Bytes
# 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
# === 修改点 1: 增加 curl 的安装 ===
RUN apt-get update && \
apt-get install -y --no-install-recommends tzdata curl && \
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 . .
# === 修改点 2: 复制脚本并赋予权限 ===
COPY sync.sh run.sh ./
RUN chmod +x sync.sh run.sh
# Expose port
EXPOSE 7861
# === 修改点 3: 使用 run.sh 启动 ===
CMD ["./run.sh"]