Fix Dockerfile

This commit is contained in:
Evil0ctal 2025-02-15 01:59:11 -08:00
parent be7752a812
commit b438d69f84

View File

@ -1,33 +1,26 @@
# Use the official Ubuntu base image # 使用官方 Python 3.11 的轻量版镜像
FROM ubuntu:22.04 FROM python:3.11-slim
LABEL maintainer="Evil0ctal" LABEL maintainer="Evil0ctal"
# Set non-interactive frontend (useful for Docker builds) # 设置非交互模式,避免 Docker 构建时的交互问题
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Update the package list and install Python and pip # 设置工作目录
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.11 python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Upgrade pip to the latest version
RUN pip3 install -U pip
# Set a working directory
WORKDIR /app WORKDIR /app
# Copy the application source code to the container # 复制应用代码到容器
COPY . /app COPY . /app
# Install pip and set the PyPI mirror (Aliyun) # 使用 Aliyun 镜像源加速 pip
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ -U pip \ RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ -U pip \
&& pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# Install dependencies directly # 安装依赖
RUN pip3 install --no-cache-dir -r requirements.txt RUN pip install --no-cache-dir -r requirements.txt
# Make the start script executable # 确保启动脚本可执行
RUN chmod +x start.sh RUN chmod +x start.sh
# Command to run on container start # 设置容器启动命令
CMD ["./start.sh"] CMD ["./start.sh"]