generated from unkin/docker-template
Merge pull request 'feat: enable multirelease' (#6) from neoloc/multirelease into master
All checks were successful
Deploy / build (push) Successful in 1m59s
All checks were successful
Deploy / build (push) Successful in 1m59s
Reviewed-on: https://git.query.consul/unkin/docker-almalinux-jupyterinstance/pulls/6
This commit is contained in:
commit
93c0e3af35
57
Makefile
57
Makefile
@ -1,37 +1,48 @@
|
|||||||
# Get the current Git commit hash
|
# Variables
|
||||||
GIT_COMMIT := $(shell git rev-parse --short HEAD)
|
GIT_COMMIT := $(shell git rev-parse --short HEAD)
|
||||||
|
|
||||||
# Get the current date in YYYYMMDD format
|
|
||||||
DATE_TAG := $(shell date +%Y%m%d)
|
DATE_TAG := $(shell date +%Y%m%d)
|
||||||
|
|
||||||
# Set the Docker image name and repository information
|
|
||||||
IMAGE_NAME := almalinux8-jupyterinstance
|
|
||||||
REGISTRY := git.query.consul
|
REGISTRY := git.query.consul
|
||||||
OWNER := unkin
|
OWNER := unkin
|
||||||
|
|
||||||
# Build the Docker image (without tags)
|
# List of releases (directories under ./release)
|
||||||
build:
|
RELEASES := $(shell find release -mindepth 1 -maxdepth 1 -type d -exec basename {} \;)
|
||||||
docker build --network=host -t $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) .
|
|
||||||
|
|
||||||
# Tag the Docker image with the Git commit hash, the date, and 'latest'
|
# Build all releases
|
||||||
tag:
|
build: $(addprefix build-,$(RELEASES))
|
||||||
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(GIT_COMMIT)
|
|
||||||
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):$(DATE_TAG)
|
|
||||||
docker tag $(REGISTRY)/$(OWNER)/$(IMAGE_NAME) $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest
|
|
||||||
|
|
||||||
# Push the Docker image to a repository with all tags
|
# Tag all releases
|
||||||
push: tag
|
tag: $(addprefix tag-,$(RELEASES))
|
||||||
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
|
# Push all releases
|
||||||
|
push: $(addprefix push-,$(RELEASES))
|
||||||
|
|
||||||
|
# Clean dangling images
|
||||||
clean:
|
clean:
|
||||||
docker image prune -f
|
docker image prune -f
|
||||||
sudo docker rm jupyterinstance
|
|
||||||
|
|
||||||
test:
|
# List all available releases
|
||||||
sudo docker run -it --name jupyterinstance --entrypoint /bin/bash -v jupyterhub-test:/home/jupyter/work $(REGISTRY)/$(OWNER)/$(IMAGE_NAME):latest
|
list:
|
||||||
|
@echo "Available releases:"
|
||||||
|
@echo $(RELEASES) | tr ' ' '\n'
|
||||||
|
|
||||||
|
# Build a specific release
|
||||||
|
build-%:
|
||||||
|
$(info Building almalinux$*-jupyterinstance Docker image)
|
||||||
|
docker build --network=host -t $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance -f release/$*/Dockerfile release/$*
|
||||||
|
|
||||||
|
# Tag a specific release
|
||||||
|
tag-%:
|
||||||
|
$(info Tagging almalinux$*-jupyterinstance Docker image)
|
||||||
|
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance:$(GIT_COMMIT)
|
||||||
|
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance:$(DATE_TAG)
|
||||||
|
docker tag $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance:latest
|
||||||
|
|
||||||
|
# Push a specific release
|
||||||
|
push-%: tag-%
|
||||||
|
$(info Pushing almalinux$*-jupyterinstance Docker image)
|
||||||
|
docker push $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance:$(GIT_COMMIT)
|
||||||
|
docker push $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance:$(DATE_TAG)
|
||||||
|
docker push $(REGISTRY)/$(OWNER)/almalinux$*-jupyterinstance:latest
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
default: build
|
default: build
|
||||||
|
|||||||
43
release/9/Dockerfile
Normal file
43
release/9/Dockerfile
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Start with the AlmaLinux 8.10 base image
|
||||||
|
FROM git.query.consul/unkin/almalinux9:latest
|
||||||
|
|
||||||
|
# Clean and update the repository cache
|
||||||
|
RUN dnf clean all && \
|
||||||
|
dnf makecache
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
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'
|
||||||
|
|
||||||
|
# install additional python modules
|
||||||
|
RUN /opt/jupyter/bin/pip install \
|
||||||
|
numpy \
|
||||||
|
pandas \
|
||||||
|
matplotlib \
|
||||||
|
pyarrow \
|
||||||
|
pyyaml
|
||||||
|
|
||||||
|
# create a user, since we don't want to run as root
|
||||||
|
RUN useradd -m jupyter
|
||||||
|
ENV HOME=/home/jupyter
|
||||||
|
RUN mkdir $HOME/work
|
||||||
|
RUN chown jupyter:jupyter $HOME/work
|
||||||
|
WORKDIR $HOME/work
|
||||||
|
USER jupyter
|
||||||
|
|
||||||
|
# set the default command
|
||||||
|
CMD ["/opt/jupyter/bin/jupyterhub-singleuser"]
|
||||||
Reference in New Issue
Block a user