add jupyterlab.Dockerfile
This commit is contained in:
parent
ecb8d60498
commit
a539a3e633
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
.env
|
||||
.venv
|
||||
test/
|
||||
.DS_Store
|
||||
index.html
|
||||
27
jupyterlab.Dockerfile
Normal file
27
jupyterlab.Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
FROM docker.wgqcd.com/library/alpine:3.20.3
|
||||
ENV ENV_NAME=.venv
|
||||
ENV LANG=zh_CN.UTF-8
|
||||
ENV JUPYTER_TOKEN=piaoruYUN123
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
|
||||
# 安装基础依赖
|
||||
RUN apk add --no-cache python3 py3-pip gcc python3-dev musl-dev linux-headers
|
||||
RUN echo -e 'if [[ -d /data/${ENV_NAME} ]]; then\n \
|
||||
source /data/.venv/bin/activate\n \
|
||||
else\n \
|
||||
echo "No ${ENV_NAME} file found, create env"\n \
|
||||
python3 -m venv /data/${ENV_NAME}\n \
|
||||
source /data/${ENV_NAME}/bin/activate\n \
|
||||
fi\n \
|
||||
jupyter_exist=$(which jupyter)\n \
|
||||
if [ -z "$jupyter_exist" ]; then\n \
|
||||
echo "jupyter not found, installing..."\n \
|
||||
pip install jupyterlab jupyterlab-language-pack-zh-CN -i https://pypi.tuna.tsinghua.edu.cn/simple/\n \
|
||||
fi\n \
|
||||
jupyter lab --ip=0.0.0.0 --port=8888 --ExtensionApp.settings=autoCompletion=true --IdentityProvider.token=${JUPYTER_TOKEN} --no-browser --allow-root' > /usr/bin/startup.sh
|
||||
RUN chmod +x /usr/bin/startup.sh
|
||||
# 创建工作目录
|
||||
WORKDIR /data
|
||||
# 暴露端口
|
||||
EXPOSE 8888
|
||||
# 启动 JupyterLab
|
||||
CMD ["sh", "-c", "/usr/bin/startup.sh"]
|
||||
Loading…
Reference in New Issue
Block a user