ยง2023-01-18
- Dockerfile
#
# 2023-01-18
#
ARG BASE_IMAGE=archlinux
FROM $BASE_IMAGE AS builder
# update
RUN pacman -Sy
#
# Insatll python3
#
RUN yes | pacman -S python3
RUN yes | pacman -S python-pip # pip and pip3 installed
#
# nodejs and npm
#
RUN yes | pacman -S nodejs npm
#
# install jupyterhub using pip and npm
# https://jupyterhub.readthedocs.io/en/stable/quickstart.html#installation
#RUN yes | pacman -S jupyterhub # no good
#
RUN python3 -m pip install jupyterhub
RUN npm install -g configurable-http-proxy
RUN python3 -m pip install jupyterlab notebook # needed if running the notebook servers in the same environment
#
#
#
#
# add user alexlai
#
# -r: create system account, -m create home directory
RUN useradd -m -d /home/alexlai -s /bin/bash -G wheel -u 1026 alexlai
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN echo 'alexlai:alex1765' | chpasswd
#
# mkdir JupyterHub the mount poiny of shared file folder
#
RUN mkdir /home/alexlai/JupyterHub
#
#
# install redis
#
EXPOSE 8000
LABEL maintainer="alexlai@munetaka.me"
CMD ["jupyterhub"]
#
# Notes
#
# sudo docker build --tag jupyterhub:archlinux_x86_64 (--no-cache) ./
# sudo docker run -it jupyterhub:archlinux_x86_64
# sudo docker run -d -p 42100:8000 --mount type=bind,source=/volume1/JupyterHub,target=/home/alexlai/JupyterHub --name jupyterhub jupyterhub:archlinux_x86_64 jupyterhub
# outside-port:inside-port
# docker ps
# docker stop (NAMES)
# docker rm (NAMES)