From 73a64a8195d3a0b55447e77ada9c83e0ab3b743c Mon Sep 17 00:00:00 2001 From: meihuisu Date: Thu, 16 Jan 2025 07:05:21 +0000 Subject: [PATCH] add test --- test_jupyterLab/Dockerfile | 36 +++++++++++++++++++++++++++++++++ test_jupyterLab/build.py | 31 ++++++++++++++++++++++++++++ ucvm_v22_7_quakeworx/Dockerfile | 2 +- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 test_jupyterLab/Dockerfile create mode 100755 test_jupyterLab/build.py diff --git a/test_jupyterLab/Dockerfile b/test_jupyterLab/Dockerfile new file mode 100644 index 0000000..68dc439 --- /dev/null +++ b/test_jupyterLab/Dockerfile @@ -0,0 +1,36 @@ +# Use the official Python image as a base +FROM python:3.9-slim + +# Set environment variables to avoid writing bytecode and to make output unbuffered +ENV PYTHONUNBUFFERED=1 +ENV PYTHONDONTWRITEBYTECODE=1 + +# Install system dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +# Install Python dependencies (JupyterLab and common data science libraries) +RUN pip install --no-cache-dir \ + jupyterlab \ + pandas \ + numpy \ + matplotlib \ + seaborn \ + scikit-learn \ + scipy \ + ipykernel \ + jupyterhub \ + notebook + +# Expose JupyterLab's port +EXPOSE 8888 + +# Set the working directory in the container +WORKDIR /app + +# Start JupyterLab when the container is run +CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser"] + + diff --git a/test_jupyterLab/build.py b/test_jupyterLab/build.py new file mode 100755 index 0000000..58afc6f --- /dev/null +++ b/test_jupyterLab/build.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# This script is used to update the inputs models and generate new docker build scripts for each configuration +# + +import os +import datetime + +## pip install py-cpuinfo +import cpuinfo + +if __name__ == '__main__': + + ## this is a bug in docker about apple's M1 chip + cpudata = cpuinfo.get_cpu_info()['brand_raw'] + cpuname = cpudata.split(" ")[1] + + # build date tag + dt=datetime.datetime.today() + month=dt.month + day=dt.day + mdate="%02d%02d"%(month,day) + + cmd = "docker build -t test_jupyterlab:%s ."%(mdate) + os.system(cmd) + + cmd = "docker tag test_jupyterlab:%s mpihuisu/test_jupyterlab:latest"%(mdate) + os.system(cmd) + + cmd = "docker push mpihuisu/test_jupyterlab:latest" + os.system(cmd) + diff --git a/ucvm_v22_7_quakeworx/Dockerfile b/ucvm_v22_7_quakeworx/Dockerfile index a992f03..8044c94 100644 --- a/ucvm_v22_7_quakeworx/Dockerfile +++ b/ucvm_v22_7_quakeworx/Dockerfile @@ -127,4 +127,4 @@ ARG PATH="/usr/local/opt/conda/bin:${PATH}" #ENTRYPOINT ["/bin/bash"] # Define the command to run JupyterLab -CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--allow-root"] +CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser"]