Commit e9241c46 authored by chenpangpang's avatar chenpangpang
Browse files

feat: 优化镜像构建

parent 9ee4e988
...@@ -49,13 +49,13 @@ RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \ ...@@ -49,13 +49,13 @@ RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \
ENV PATH=$PATH:/opt/conda/bin ENV PATH=$PATH:/opt/conda/bin
RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \ RUN pip3 install --upgrade pip ${SOURCES} || pip install --upgrade pip ${SOURCES} \
pip3 install --upgrade pip ${SOURCES} || pip install --upgrade pip ${SOURCES} \
&& pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple \ && pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple \
&& pip3 install --no-cache-dir setuptools ipywidgets wheel \
&& mv /etc/apt/sources.list.bak /etc/apt/sources.list \ && mv /etc/apt/sources.list.bak /etc/apt/sources.list \
&& mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d \ && mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d
&& pip3 install matplotlib; fi
COPY ./python-requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/python-requirements.txt
# 安装pytorch 需要设置代理 # 安装pytorch 需要设置代理
#ENV http_proxy=http://ac19pn3az3:M36tPjtQ@10.21.131.1:3128/ #ENV http_proxy=http://ac19pn3az3:M36tPjtQ@10.21.131.1:3128/
...@@ -66,16 +66,20 @@ RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \ ...@@ -66,16 +66,20 @@ RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \
--index-url https://download.pytorch.org/whl/cu$(echo "$BASE_IMAGE" | awk -F'[:-]' '{n=split($2,a,"."); print a[1] a[2]}') \ --index-url https://download.pytorch.org/whl/cu$(echo "$BASE_IMAGE" | awk -F'[:-]' '{n=split($2,a,"."); print a[1] a[2]}') \
&& rm -r /root/.cache/pip; fi && rm -r /root/.cache/pip; fi
# 安装jupyterlab插件 ### 添加HF的镜像变量
ENV HF_ENDPOINT=https://hf-mirror.com
RUN echo 'export HF_ENDPOINT=https://hf-mirror.com' >> /etc/bash.bashrc && \
echo 'export HF_ENDPOINT=https://hf-mirror.com' >> ~/.bashrc && \
echo 'export CUDA_HOME=/usr/local/cuda' >> /etc/bash.bashrc
# 安装jupyterlab插件, 生成sshd配置
RUN pip3 install jupyterlab==4.0.0 RUN pip3 install jupyterlab==4.0.0
RUN mkdir -p /tmp/jupyter-extension RUN mkdir -p /tmp/jupyter-extension
COPY ./jupyter_ext_dataset-0.1.0-py3-none-any.whl /tmp/jupyter-extension/ COPY ./jupyter_ext_dataset-0.1.0-py3-none-any.whl /tmp/jupyter-extension/
COPY ./jupyter_ext_logo-0.1.0-py3-none-any.whl /tmp/jupyter-extension/ COPY ./jupyter_ext_logo-0.1.0-py3-none-any.whl /tmp/jupyter-extension/
COPY ./jupyterlab_language_pack_zh_cn-4.0.post6-py2.py3-none-any.whl /tmp/jupyter-extension/ COPY ./jupyterlab_language_pack_zh_cn-4.0.post6-py2.py3-none-any.whl /tmp/jupyter-extension/
COPY ./requirements.txt /tmp/jupyter-extension/ COPY ./requirements.txt /tmp/jupyter-extension/
COPY ./static /tmp/jupyter-extension/static COPY ./static /tmp/jupyter-extension/static
COPY extension.sh /tmp/ COPY extension.sh /tmp/
RUN chmod +x /tmp/extension.sh && \ RUN chmod +x /tmp/extension.sh && \
/tmp/extension.sh /tmp/extension.sh
...@@ -93,8 +97,6 @@ RUN jupytersite="$(python3 -m pip show jupyterlab | grep -i '^location' | awk '{ ...@@ -93,8 +97,6 @@ RUN jupytersite="$(python3 -m pip show jupyterlab | grep -i '^location' | awk '{
&& ssh-keygen -A \ && ssh-keygen -A \
&& sed -i "s/#UseDNS .*/UseDNS no/" /etc/ssh/sshd_config && sed -i "s/#UseDNS .*/UseDNS no/" /etc/ssh/sshd_config
COPY ./python-requirements.txt /tmp/
RUN pip install -r /tmp/python-requirements.txt ${SOURCES}
EXPOSE 8888 EXPOSE 8888
......
matplotlib setuptools
\ No newline at end of file ipywidgets
wheel
matplotlib
transformers
git-lfs
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment