20 lines
410 B
Docker
20 lines
410 B
Docker
|
# 使用官方 Python 基础镜像
|
||
|
FROM python:3.11-slim-buster
|
||
|
|
||
|
# 设置工作目录
|
||
|
WORKDIR /app
|
||
|
|
||
|
# 将项目文件复制到容器中
|
||
|
COPY. /app
|
||
|
|
||
|
# 安装项目依赖
|
||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
|
||
|
# 设置环境变量
|
||
|
ENV DJANGO_SETTINGS_MODULE=your_project_name.settings
|
||
|
|
||
|
# 暴露容器端口
|
||
|
EXPOSE 8000
|
||
|
|
||
|
# 运行 Django 项目
|
||
|
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|