Spaces:
Sleeping
Sleeping
File size: 1,081 Bytes
91b5bcf 781f040 91b5bcf c5d967b 91b5bcf 781f040 954b754 bdaf5db 954b754 781f040 954b754 781f040 954b754 781f040 91b5bcf 781f040 c5d967b 781f040 91b5bcf c5d967b 781f040 91b5bcf c5d967b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# 使用官方OCRmyPDF Alpine镜像作为基础
FROM jbarlow83/ocrmypdf-alpine:latest
# 设置环境变量
ENV PORT=8000
ENV PYTHONUNBUFFERED=1
# 安装Python和必要的构建工具
RUN apk add --no-cache python3 py3-pip python3-dev build-base
# 设置工作目录
WORKDIR /app
# 创建和激活虚拟环境
RUN python3 -m venv /app/venv
ENV PATH="/app/venv/bin:$PATH"
# 复制并安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制应用代码和启动脚本
COPY main.py .
COPY entrypoint.sh .
# 设置启动脚本权限
RUN chmod +x /app/entrypoint.sh
# 创建临时工作目录
RUN mkdir -p /app/temp
RUN chmod 777 /app/temp
# 暴露端口
EXPOSE 8000
# 使用入口脚本启动应用
ENTRYPOINT ["/app/entrypoint.sh"]
# 复制应用代码和启动脚本
COPY main.py .
COPY entrypoint.sh .
# 设置启动脚本权限
RUN chmod +x /app/entrypoint.sh
# 创建临时工作目录
RUN mkdir -p /app/temp
RUN chmod 777 /app/temp
# 暴露端口
EXPOSE 8000
# 使用入口脚本启动应用
ENTRYPOINT ["/app/entrypoint.sh"] |