diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..53646b4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,30 @@ +name: Docker Build and Push + +on: + push: + branches: + - 'main' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push to Docker Hub + uses: docker/build-push-action@v5 + with: + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/cling-jupyter:latest + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..df2c2a5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,31 @@ +FROM quay.io/jupyter/minimal-notebook + +ARG CONDA_ENV_NAME=cling + +# Switch to root user +USER root + +# Install dependencies +RUN apt-get update && apt-get install -y \ + build-essential + +# Create and activate conda environment +RUN conda create -n $CONDA_ENV_NAME python=3.8 && \ + echo "conda activate $CONDA_ENV_NAME" >> /etc/profile.d/conda.sh && \ + conda init && \ + exec bash + +# Install xeus-cling and its dependencies +RUN /bin/bash -c "source activate $CONDA_ENV_NAME && \ + mamba install xeus-cling -c conda-forge --yes" + +# Switch back to non-root user +USER $NB_UID + +# Set the default command to start Jupyter Notebook +RUN /bin/bash -c "source activate $CONDA_ENV_NAME && \ + jupyter kernelspec install /opt/conda/envs/cling/share/jupyter/kernels/xcpp11 --sys-prefix && \ + jupyter kernelspec install /opt/conda/envs/cling/share/jupyter/kernels/xcpp14 --sys-prefix && \ + jupyter kernelspec install /opt/conda/envs/cling/share/jupyter/kernels/xcpp17 --sys-prefix" + +CMD ["jupyter", "notebook", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..f7261ec --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# Cling-Jupyter Docker Image + +This repository provides a Docker image for running Jupyter Notebooks with [xeus-cling](https://github.com/jupyter-xeus/xeus-cling). + +## Getting Started + +### Run + +```bash + docker run -it -v ~/Documents/workspace:/home/jovyan/work -p8888:8888 --rm cling-jupyter:latest +``` + +### Building the Docker Image + +To build the Docker image locally, run the following command in the repository's root directory: + +```bash +docker build -t cling-jupyter . +``` \ No newline at end of file