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.
15 lines
812 B
15 lines
812 B
FROM python:3.11
|
|
ENV PYTHONUNBUFFERED 1 # 设置Python无缓冲模式
|
|
WORKDIR /code/djangoblog/ # 设置工作目录
|
|
RUN apt-get update && \\
|
|
apt-get install default-libmysqlclient-dev gettext -y && \\ # 安装MySQL客户端和gettext
|
|
rm -rf /var/lib/apt/lists/* # 清理APT缓存
|
|
ADD requirements.txt requirements.txt # 添加依赖文件
|
|
RUN pip install --upgrade pip && \\
|
|
pip install --no-cache-dir -r requirements.txt && \\ # 安装Python依赖
|
|
pip install --no-cache-dir gunicorn[gevent] && \\ # 安装Gunicorn服务器
|
|
pip cache purge # 清理pip缓存
|
|
|
|
ADD . . # 添加项目代码
|
|
RUN chmod +x /code/djangoblog/deploy/entrypoint.sh # 给入口脚本添加执行权限
|
|
ENTRYPOINT ["/code/djangoblog/deploy/entrypoint.sh"] # 设置入口点脚本 |