From e02d3a0c6dd8d44632b1718e2d62b48855fb79d6 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 10 Nov 2024 12:39:55 +1100 Subject: [PATCH] feat: first commit of jupyterinstnace - builds container with python3.12 and minimal required pip packages --- Dockerfile | 27 +++++++++++++++++++++------ Makefile | 9 ++++----- README.md | 14 +++++++------- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9b6b199..b1932a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,29 @@ FROM git.query.consul/unkin/almalinux8:latest RUN dnf clean all && \ dnf makecache -# Install nodejs:20 for actions -RUN dnf module enable -y nodejs:20 && \ - dnf install -y nodejs - # Install packages -RUN dnf groupinstall -y 'Development Tools' && \ - dnf install -y make cmake gcc gcc-c++ rpm rpmdevtools wget +RUN dnf install -y python3.12 python3.12-pip # Cleanup RUN dnf clean all && \ rm -rf /var/cache/dnf + +# create venv for jupyter +RUN python3.12 -m venv /opt/jupyter + +# upgrade pip +RUN /opt/jupyter/bin/python -m pip install --upgrade pip + +# install requirements for jupyterhub-singleinstance +RUN /opt/jupyter/bin/pip install \ + 'jupyterhub==5.2.1' \ + 'notebook==7.2.2' + +# create a user, since we don't want to run as root +RUN useradd -m jupyter +ENV HOME=/home/jupyter +WORKDIR $HOME +USER jupyter + +# set the default command +CMD ["/opt/jupyter/bin/jupyterhub-singleuser"] diff --git a/Makefile b/Makefile index 291abb6..e966855 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ GIT_COMMIT := $(shell git rev-parse --short HEAD) DATE_TAG := $(shell date +%Y%m%d) # Set the Docker image name and repository information -IMAGE_NAME := almalinux8-template +IMAGE_NAME := almalinux8-jupyterinstance REGISTRY := git.query.consul OWNER := unkin @@ -21,10 +21,9 @@ tag: # Push the Docker image to a repository with all tags push: tag - echo "template repo, not pushing" - #docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT) - #docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG) - #docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest + docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT) + docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG) + docker push $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest # Clean up dangling Docker images clean: diff --git a/README.md b/README.md index de7908e..2a9bb26 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Docker Image Build: Almalinux Template +# Docker Image Build: Almalinux Jupyterinstance This project provides a reproducible Docker image build process for `almalinux:8.10`, with custom YUM repository configurations and package installations. The build is automated using a `Makefile` and managed via CI tasks to ensure consistent and reliable Docker image builds. @@ -16,7 +16,7 @@ To build the Docker image without tags: make build ``` -This will use the `docker build` command with `--network=host` to build the image with the name `git.query.consul/unkin/almalinux8-template`. +This will use the `docker build` command with `--network=host` to build the image with the name `git.query.consul/unkin/almalinux8-jupyterinstance. ### Tag the Docker Image @@ -27,9 +27,9 @@ make tag ``` This will add three tags to the image: -- `git.query.consul/unkin/almalinux8-template:` -- `git.query.consul/unkin/almalinux8-template:` -- `git.query.consul/unkin/almalinux8-template:latest` +- `git.query.consul/unkin/almalinux8-jupyterinstance:` +- `git.query.consul/unkin/almalinux8-jupyterinstance:` +- `git.query.consul/unkin/almalinux8-jupyterinstance:latest` ### Push the Docker Image @@ -67,8 +67,8 @@ To test or develop with this `Makefile`, follow these steps: 1. **Clone the repository** and navigate to the project directory: ```bash - git clone https://git.query.consul/unkin/docker-template.git - cd docker-template + git clone https://git.query.consul/unkin/docker-almalinux-jupyterinstance.git + cd docker-almalinux-jupyterinstance ``` 2. **Build the Docker image** using the `build` target: