21 lines
538 B
Docker
21 lines
538 B
Docker
FROM python:3.11-slim
|
|
|
|
# 设置时区为上海
|
|
ENV TZ=Asia/Shanghai
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装依赖(使用阿里云镜像)
|
|
COPY backend/requirements.txt .
|
|
RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r requirements.txt
|
|
|
|
# 复制代码
|
|
COPY backend/app ./app
|
|
|
|
# 暴露端口
|
|
EXPOSE 8000
|
|
|
|
# 启动命令
|
|
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|