Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
gpu-base-image-build
Commits
e9241c46
Commit
e9241c46
authored
Sep 18, 2024
by
chenpangpang
Browse files
feat: 优化镜像构建
parent
9ee4e988
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
build_space/Dockerfile.jupyterlab_ubuntu
build_space/Dockerfile.jupyterlab_ubuntu
+12
-10
build_space/python-requirements.txt
build_space/python-requirements.txt
+6
-1
No files found.
build_space/Dockerfile.jupyterlab_ubuntu
View file @
e9241c46
...
...
@@ -49,13 +49,13 @@ RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \
ENV PATH=$PATH:/opt/conda/bin
RUN if [ $BASE_IMAGE_IS_TORCH -eq 0 ];then \
pip3 install --upgrade pip ${SOURCES} || pip install --upgrade pip ${SOURCES} \
RUN pip3 install --upgrade pip ${SOURCES} || pip install --upgrade pip ${SOURCES} \
&& 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.d.bak /etc/apt/sources.list.d \
&& pip3 install matplotlib; fi
&& mv /etc/apt/sources.list.d.bak /etc/apt/sources.list.d
COPY ./python-requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/python-requirements.txt
# 安装pytorch 需要设置代理
#ENV http_proxy=http://ac19pn3az3:M36tPjtQ@10.21.131.1:3128/
...
...
@@ -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]}') \
&& 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 mkdir -p /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 ./jupyterlab_language_pack_zh_cn-4.0.post6-py2.py3-none-any.whl /tmp/jupyter-extension/
COPY ./requirements.txt /tmp/jupyter-extension/
COPY ./static /tmp/jupyter-extension/static
COPY extension.sh /tmp/
RUN chmod +x /tmp/extension.sh && \
/tmp/extension.sh
...
...
@@ -93,8 +97,6 @@ RUN jupytersite="$(python3 -m pip show jupyterlab | grep -i '^location' | awk '{
&& ssh-keygen -A \
&& 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
...
...
build_space/python-requirements.txt
View file @
e9241c46
setuptools
ipywidgets
wheel
matplotlib
transformers
git-lfs
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment