Dockerfile 1.0 KB

12345678910111213141516171819202122232425262728
  1. FROM python:3-alpine
  2. LABEL maintainer="<author>"
  3. LABEL version="selfbuilt"
  4. WORKDIR /jupyter
  5. RUN \
  6. sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories &&\
  7. apk add --no-cache libc-dev libffi-dev gcc && \
  8. pip install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyter --no-cache-dir && \
  9. apk del libc-dev libffi-dev gcc &&\
  10. addgroup notebook &&\
  11. adduser -Ss /bin/nologin -g notebook notebook &&\
  12. chown -R notebook:notebook . &&\
  13. mkdir /data &&\
  14. chown -R notebook:notebook /data
  15. RUN \
  16. jupyter notebook --generate-config &&\
  17. mkdir ./config &&\
  18. cp /root/.jupyter/jupyter_notebook_config.py ./config
  19. RUN \
  20. sed -i.bak 's/# c.NotebookApp.ip = .*/c.NotebookApp.ip = '\''0.0.0.0'\''/' ~/.jupyter/jupyter_notebook_config.py && \
  21. sed -i.bak 's/# c.NotebookApp.notebook_dir = .*/c.NotebookApp.notebook_dir = '\''\/data'\''/' ~/.jupyter/jupyter_notebook_config.py
  22. EXPOSE 8888
  23. USER notebook
  24. CMD [ "jupyter", "notebook", "--config=", "\"/jupyter/config\"" ]