CoI_Agent / Dockerfile
jianghuyihei's picture
first commit
863d8a3
FROM python:3.9
# 创建用户并切换到该用户
RUN useradd -m -u 1000 user
# 设置环境变量
ENV PATH="/home/user/.local/bin:$PATH"
# /home/user/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN echo $PATH
# 设置环境变量,以避免在安装过程中出现交互提示
ENV DEBIAN_FRONTEND=noninteractive
# 设置工作目录
WORKDIR /app
USER root
# # 安装 sudo
RUN apt-get update && apt-get install -y sudo supervisor
# 克隆并安装 scipdf_parser
RUN git clone -q https://github.com/titipata/scipdf_parser.git
RUN pip install -q git+https://github.com/titipata/scipdf_parser
# 进入 scipdf_parser 目录并安装 spaCy 模型
WORKDIR /app/scipdf_parser
RUN python -m spacy download en_core_web_sm
# 返回工作目录
WORKDIR /app
# 复制requirements.txt文件并安装Python依赖
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install -q python-multipart
RUN pip install -q --upgrade pip
RUN pip install -q --upgrade -r requirements.txt
# 下载并解压 OpenJDK 11
RUN wget -q https://download.oracle.com/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz \
&& tar -zxvf openjdk-11.0.2_linux-x64_bin.tar.gz > /dev/null \
&& mv jdk-11.0.2 /opt/ \
&& rm openjdk-11.0.2_linux-x64_bin.tar.gz
# 设置环境变量
ENV JAVA_HOME=/opt/jdk-11.0.2
ENV PATH=$JAVA_HOME/bin:$PATH
# 验证 Java 安装
RUN java -version
# RUN sudo apt-get install -y maven
RUN wget -q https://github.com/kermitt2/grobid/archive/0.7.3.zip
RUN unzip 0.7.3.zip > /dev/null
# 安装依赖
RUN git clone -q https://github.com/kermitt2/grobid.git
WORKDIR /app/grobid
RUN chmod +x gradlew
RUN ./gradlew clean install --console=plain
WORKDIR /app
# 暴露端口
EXPOSE 8070
EXPOSE 7860
COPY --chown=user ./start.sh start.sh
RUN chmod +x start.sh
RUN chmod -R 777 grobid
# 复制应用程序代码
COPY --chown=user . /app
CMD ["./start.sh"]
# CMD ["supervisord", "-c", "supervisord.conf"]
# # 设置默认命令
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
# "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"
# uvicorn app:app --host "0.0.0.0" --port 7860