Dockerfile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. FROM python:alpine
  2. # Install required packages
  3. RUN apk add --update --virtual=.build-dependencies alpine-sdk nodejs ca-certificates musl-dev gcc python-dev make cmake g++ gfortran libpng-dev freetype-dev libxml2-dev libxslt-dev
  4. RUN apk add --update git
  5. # Install Jupyter
  6. RUN pip install jupyter
  7. RUN pip install ipywidgets
  8. RUN jupyter nbextension enable --py widgetsnbextension
  9. # Install JupyterLab
  10. RUN pip install jupyterlab && jupyter serverextension enable --py jupyterlab
  11. # Additional packages for compatability (glibc)
  12. RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub && \
  13. wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-2.23-r3.apk && \
  14. wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-i18n-2.23-r3.apk && \
  15. wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.23-r3/glibc-bin-2.23-r3.apk && \
  16. apk add --no-cache glibc-2.23-r3.apk glibc-bin-2.23-r3.apk glibc-i18n-2.23-r3.apk && \
  17. rm "/etc/apk/keys/sgerrand.rsa.pub" && \
  18. /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 C.UTF-8 || true && \
  19. echo "export LANG=C.UTF-8" > /etc/profile.d/locale.sh && \
  20. ln -s /usr/include/locale.h /usr/include/xlocale.h
  21. # Optional Clean-up
  22. # RUN apk del glibc-i18n && \
  23. # apk del .build-dependencies && \
  24. # rm glibc-2.23-r3.apk glibc-bin-2.23-r3.apk glibc-i18n-2.23-r3.apk && \
  25. # rm -rf /var/cache/apk/*
  26. ENV LANG=C.UTF-8
  27. # Install Python Packages & Requirements (Done near end to avoid invalidating cache)
  28. COPY requirements.txt requirements.txt
  29. RUN pip install -r requirements.txt
  30. # Expose Jupyter port & cmd
  31. EXPOSE 8888
  32. RUN mkdir -p /opt/app/data
  33. CMD jupyter lab --ip=* --port=8888 --no-browser --notebook-dir=/opt/app/data --allow-root