You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
487 B
26 lines
487 B
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# 安装依赖
|
|
COPY backend/requirements.txt .
|
|
RUN pip install --no-cache-dir \
|
|
-i https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
--trusted-host pypi.tuna.tsinghua.edu.cn \
|
|
-r requirements.txt
|
|
|
|
# 复制所有文件
|
|
COPY . .
|
|
|
|
# 环境变量(可被 docker-compose 覆盖)
|
|
ENV FLASK_ENV=production
|
|
ENV DB_HOST=db
|
|
ENV DB_PORT=3306
|
|
ENV DB_USER=root
|
|
ENV DB_PASSWORD=lingshu123
|
|
ENV DB_NAME=lingshu
|
|
|
|
EXPOSE 5000
|
|
|
|
CMD ["python", "backend/app.py"]
|