Transcrib3D-Demo / Dockerfile
kudo1026
initial
f27a827
# 使用ubuntu22.04作为基础镜像
FROM ubuntu:22.04
# 设置工作目录为/Transcrib3D-Demo/
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
# 无vpn时需要换源:
# COPY ./sources.list /etc/apt/
# RUN mkdir -p ~/.pip
# RUN echo "[global]" >> ~/.pip/pip.conf
# RUN echo "index-url = https://pypi.tuna.tsinghua.edu.cn/simple" >> ~/.pip/pip.conf
# RUN cat ~/.pip/pip.conf
RUN apt-get update
RUN apt-get install -y wget
RUN apt-get install -y python3-pip
RUN pip3 config list
RUN apt-get install -y sudo
RUN apt-get install -y vim
# 在/root/Downloads目录下下载libssl包
RUN mkdir -p /root/Downloads && \
wget -P /root/Downloads http://archive.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb && \
dpkg -i /root/Downloads/libssl1.0.0_1.0.2n-1ubuntu5_amd64.deb
# 安装requirements.txt中的Python依赖项
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user
# Switch to the "user" user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory to the user's home directory
WORKDIR $HOME/app
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
# 可以设置容器启动后默认执行的命令,这里我们只是为示例,所以不设置任何启动命令
# CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
CMD [ "python3", "app.py" ]