1234567891011121314151617181920212223242526272829303132 |
- FROM registry.cn-hangzhou.aliyuncs.com/serverless_devs/pytorch:22.12-py3
- RUN pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
- RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list && \
- sed -i 's|http://security.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list
- # 设置工作目录
- WORKDIR /app
- # 设置环境变量
- ENV PYTHONUNBUFFERED=1 \
- PYTHONDONTWRITEBYTECODE=1 \
- PIP_NO_CACHE_DIR=1
- # 安装系统依赖
- RUN apt-get update && apt-get install -y --no-install-recommends \
- build-essential \
- libmagic1 \
- && rm -rf /var/lib/apt/lists/*
- # 复制项目文件
- COPY . .
- # 安装Python依赖
- RUN pip install --no-cache-dir -r requirements.txt
- EXPOSE 5001
- # 设置默认命令
- CMD ["python", "vector_func.py"]
|