diff --git a/Dockerfile b/Dockerfile index 37a7f72..0b1e8f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,18 @@ +# 使用python:3.8-slim-buster作为基础镜像 FROM python:3.8-slim-buster +# 创建app目录来存储我们的代码 RUN mkdir /app -COPY ./*.txt ./*.py ./*.sh ./*.onnx /app/ - - -RUN cd /app \ - && python3 -m pip install --upgrade pip -i https://pypi.douban.com/simple/\ - && pip3 install --no-cache-dir -r requirements.txt --extra-index-url https://pypi.douban.com/simple/ \ - && rm -rf /tmp/* && rm -rf /root/.cache/* \ - && sed -i 's#http://deb.debian.org#http://mirrors.aliyun.com/#g' /etc/apt/sources.list\ - && apt-get --allow-releaseinfo-change update && apt install libgl1-mesa-glx libglib2.0-0 -y - +# 将工作目录设置为/app,这意味着后续的指令都在/app下执行 WORKDIR /app +# 将当前目录(即你的项目目录)下的所有文件和文件夹复制到镜像的/app目录下 +COPY . /app + +# 安装Python依赖 +RUN pip3 install --no-cache-dir ddddocr flask + + +# 定义容器启动时要运行的命令 CMD ["python3", "ocr_server.py", "--port", "9898", "--ocr", "--det"]