Update Dockerfile

This commit is contained in:
wenjiaran 2023-07-02 11:42:59 +08:00 committed by GitHub
parent 7f37543ffb
commit e8a765e19b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"]