From efcb567f739072bf0ba6d6f44e13672f546a659b Mon Sep 17 00:00:00 2001 From: Kris Simon Date: Mon, 6 Oct 2025 23:47:13 +0200 Subject: [PATCH 1/4] Refactor Dockerfile with downlaoder box --- codebook.sh | 8 +++--- deployment/Dockerfile | 67 +++++++++++++++++++++++++++++++------------ docker-compose.yaml | 3 +- 3 files changed, 53 insertions(+), 25 deletions(-) diff --git a/codebook.sh b/codebook.sh index 36128c2..0fc887f 100755 --- a/codebook.sh +++ b/codebook.sh @@ -3,19 +3,19 @@ # # Setup script to run CodeBook on current folder # -# curl https://raw.githubusercontent.com/KrisSimon/CodeBook/main/codebook.sh | sh - +# curl https://raw.githubusercontent.com/aus-der-Technik//CodeBook/main/codebook.sh | sh - # set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/" >/dev/null 2>&1 && pwd)" if [ ! -f "${SCRIPT_DIR}/.env" ]; then - curl https://raw.githubusercontent.com/KrisSimon/CodeBook/main/.env >> .env + curl https://raw.githubusercontent.com/aus-der-Technik//CodeBook/main/.env >> .env fi if [ ! -f "${SCRIPT_DIR}/docker-compose.yaml" ]; then - curl https://raw.githubusercontent.com/KrisSimon/CodeBook/main/docker-compose.yaml >> "${SCRIPT_DIR}/docker-compose.yaml" + curl https://raw.githubusercontent.com/aus-der-Technik//CodeBook/main/docker-compose.yaml >> "${SCRIPT_DIR}/docker-compose.yaml" fi if [ ! -f "${SCRIPT_DIR}/settings.json" ]; then - curl https://raw.githubusercontent.com/KrisSimon/CodeBook/main/settings.json >> "${SCRIPT_DIR}/settings.json" + curl https://raw.githubusercontent.com/aus-der-Technik//CodeBook/main/settings.json >> "${SCRIPT_DIR}/settings.json" fi if [ ! -d "${SCRIPT_DIR}/startup" ]; then mkdir "${SCRIPT_DIR}/startup" diff --git a/deployment/Dockerfile b/deployment/Dockerfile index f3e4848..b945425 100644 --- a/deployment/Dockerfile +++ b/deployment/Dockerfile @@ -1,3 +1,38 @@ +# ---------------------------------------------------------------------------------------- +# DOWNLOADER +# ---------------------------------------------------------------------------------------- +ARG BASEIMAGE=ubuntu:24.04 +FROM ${BASEIMAGE} AS downloader + +# Install OS updates and, if needed +RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true +RUN apt-get update && apt-get install -y apt-utils \ + apt-transport-https \ + software-properties-common \ + -y + +RUN apt install -y \ + curl wget + +WORKDIR /downloads + +# kubectl +RUN SYSARCH=$(arch); \ + if [ "$SYSARCH" = "aarch64" ]; then SYSARCH=arm64; fi; \ + if [ "$SYSARCH" = "x86_64" ]; then SYSARCH=amd64; fi; \ + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${SYSARCH}/kubectl"; \ + chmod 755 /downloads/kubectl + +# Helm +RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3; \ + chmod 700 /downloads/get_helm.sh; + +# Spark +RUN wget https://archive.apache.org/dist/spark/spark-3.5.5/spark-3.5.5-bin-hadoop3.tgz + +# Swiftly +RUN curl -o swiftly.tar.gz -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz + # ---------------------------------------------------------------------------------------- # BUILD STAGE # ---------------------------------------------------------------------------------------- @@ -28,7 +63,7 @@ RUN apt install -y \ glibc-tools gcc \ cmake \ golang \ - libzmq3-dev libsodium23 pkg-config python3-aiozmq \ + libsodium23 pkg-config \ lldb-15 rust-all \ openjdk-8-jdk \ lua-any lua-argparse lua-check lua-cjson lua-doc lua-event lua-filesystem lua-http lua-json lua-posix lua-socket lua-system lua5.4 luadoc luajit \ @@ -36,18 +71,12 @@ RUN apt install -y \ kubecolor kubectx \ php composer -# kube -RUN SYSARCH=$(arch); \ - if [ "$SYSARCH" = "aarch64" ]; then SYSARCH=arm64; fi; \ - if [ "$SYSARCH" = "x86_64" ]; then SYSARCH=amd64; fi; \ - curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${SYSARCH}/kubectl"; \ - chmod 755 kubectl; \ - mv kubectl /usr/local/bin/ +# kubectl +COPY --from=downloader /downloads/kubectl /usr/local/bin/ # helm -RUN curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | tee /usr/share/keyrings/helm.gpg > /dev/null; \ - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list; \ - apt-get update; apt-get install helm -y; +COPY --from=downloader /downloads/get_helm.sh /tmp/get_helm.sh +RUN /tmp/get_helm.sh # fix LLDB RUN apt install python3-lldb-14 -y; \ @@ -61,7 +90,6 @@ RUN pip install setuptools --break-system-packages RUN mkdir /project && chmod 777 /project COPY ./Sources/entrypoint.sh / - # Install Python # ---------------------------------------------------------------------------------------- RUN ln -s /usr/bin/python3 /usr/bin/python @@ -69,25 +97,23 @@ RUN ln -s /usr/bin/python3 /usr/bin/python # Install Spark # ---------------------------------------------------------------------------------------- WORKDIR /opt/spark -RUN wget https://archive.apache.org/dist/spark/spark-3.5.5/spark-3.5.5-bin-hadoop3.tgz; \ - tar -xvzf spark-3.5.5-bin-hadoop3.tgz; \ +COPY --from=downloader /downloads/spark-3.5.5-bin-hadoop3.tgz /opt/spark/spark-3.5.5-bin-hadoop3.tgz +RUN tar -xvzf spark-3.5.5-bin-hadoop3.tgz; \ rm spark-3.5.5-bin-hadoop3.tgz ENV SPARK_HOME=/opt/spark/spark-3.5.5-bin-hadoop3 RUN echo 'SPARK_HOME=/opt/spark/spark-3.5.5-bin-hadoop3' >> /root/.bashrc RUN echo 'PATH="$JAVA_HOME/bin:$SPARK_HOME/bin:$PATH"' >> /root/.bashrc RUN pip install findspark --break-system-packages - # Install Swift # ---------------------------------------------------------------------------------------- WORKDIR /opt/swiftly -RUN curl -O https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz && \ - tar zxf swiftly-$(uname -m).tar.gz && \ +COPY --from=downloader /downloads/swiftly.tar.gz /opt/swiftly/swiftly.tar.gz +RUN tar zxf swiftly.tar.gz && \ ./swiftly init --quiet-shell-followup -y && \ . ~/.local/share/swiftly/env.sh && \ hash -r \ RUN echo 'source /root/.local/share/swiftly/env.sh' >> /root/.bashrc - RUN /root/.local/share/swiftly/bin/swift --version # Install NodeJS @@ -120,7 +146,10 @@ RUN rm -rf /extensions/install/* RUN pip install ipywidgets --break-system-packages RUN pip install bash_kernel --break-system-packages; python3 -m bash_kernel.install RUN npm install -g tslab --break-system-packages; tslab install; + +RUN apt install -y libzmq3-dev python3-aiozmq # need to install it late, because of some python dependencies RUN cpan -T Alien::ZMQ::latest; cpan -T Devel::IPerl; iperl kernel; + RUN pip install jupyter-c-kernel --break-system-packages; install_c_kernel; RUN pip install ilua --break-system-packages; RUN pip install dockerfile-kernel --break-system-packages; python3 -m dockerfile_kernel.install @@ -130,7 +159,7 @@ RUN pip install /extensions/kernel/echo_kernel --break-system-packages RUN pip install /extensions/kernel/swift_kernel --break-system-packages RUN echo 'PATH="$PATH:/root/.cargo/bin"' >> /root/.bashrc -#RUN cargo install evcxr_jupyter; /root/.cargo/bin/evcxr_jupyter --install; +#RUN cargo install --locked evcxr_jupyter; /root/.cargo/bin/evcxr_jupyter --install; #cp -r /root/.local/share/jupyter/kernels/rust /extensions/kernel/rust # Setting the startp diff --git a/docker-compose.yaml b/docker-compose.yaml index 293b035..e0f2b80 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,4 @@ -version: '3.7' - +# CodeBook Deployment x-shared_environment: &shared_environment BASEIMAGE: ${BASEIMAGE} IMAGE: ${IMAGE} From 4ab89e69b4a0c48c10e82d0fe28b9af6ee31b44d Mon Sep 17 00:00:00 2001 From: Kris Simon Date: Mon, 6 Oct 2025 23:50:43 +0200 Subject: [PATCH 2/4] add feature pipeline --- .github/workflows/feature.yaml | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/feature.yaml diff --git a/.github/workflows/feature.yaml b/.github/workflows/feature.yaml new file mode 100644 index 0000000..e1bcbfd --- /dev/null +++ b/.github/workflows/feature.yaml @@ -0,0 +1,43 @@ +name: Build Codeserver +on: + push: + branches: + - feature/* + +jobs: + build: + name: Build + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata for the Docker image + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ghcr.io/${{ github.repository }} + - name: lowercase github.repository + run: | + echo "lc_repository=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV} + + - name: Build Docker Image + uses: docker/build-push-action@v5 + with: + file: deployment/Dockerfile + push: false + platforms: linux/amd64,linux/arm64 + tags: | + ghcr.io/${{ env.lc_repository }}:${{ steps.meta.outputs.tags }} + From 49a6dd5c4d8197c3c1911d047cb65a12b16fa92a Mon Sep 17 00:00:00 2001 From: Kris Simon Date: Mon, 6 Oct 2025 23:52:05 +0200 Subject: [PATCH 3/4] fix feature build image tag name --- .github/workflows/feature.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/feature.yaml b/.github/workflows/feature.yaml index e1bcbfd..cac18f2 100644 --- a/.github/workflows/feature.yaml +++ b/.github/workflows/feature.yaml @@ -39,5 +39,5 @@ jobs: push: false platforms: linux/amd64,linux/arm64 tags: | - ghcr.io/${{ env.lc_repository }}:${{ steps.meta.outputs.tags }} + ${{ steps.meta.outputs.tags }} From f4d3ee4c8cd148df71ce874bea3e3f09844dd42e Mon Sep 17 00:00:00 2001 From: Kris Simon Date: Tue, 7 Oct 2025 13:12:43 +0200 Subject: [PATCH 4/4] Add versions Workbook --- Project/examples/versions.ipynb | 189 ++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 Project/examples/versions.ipynb diff --git a/Project/examples/versions.ipynb b/Project/examples/versions.ipynb new file mode 100644 index 0000000..fa6ee40 --- /dev/null +++ b/Project/examples/versions.ipynb @@ -0,0 +1,189 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 12, + "id": "a1a31dd4", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Swift version 6.2 (swift-6.2-RELEASE)\n", + "Target: aarch64-unknown-linux-gnu\n" + ] + } + ], + "source": [ + "swift --version\n" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "4f5f17cb", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Python 3.12.3\n" + ] + } + ], + "source": [ + "python --version\n" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "e68d83ed", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "This is perl 5, version 38, subversion 2 (v5.38.2) built for aarch64-linux-gnu-thread-multi\n", + "(with 51 registered patches, see perl -V for more detail)\n", + "\n", + "Copyright 1987-2023, Larry Wall\n", + "\n", + "Perl may be copied only under the terms of either the Artistic License or the\n", + "GNU General Public License, which may be found in the Perl 5 source kit.\n", + "\n", + "Complete documentation for Perl, including FAQ lists, should be found on\n", + "this system using \"man perl\" or \"perldoc perl\". If you have access to the\n", + "Internet, point your browser at https://www.perl.org/, the Perl Home Page.\n", + "\n" + ] + } + ], + "source": [ + "perl --version\n" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "8c53340b", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "PHP 8.3.6 (cli) (built: Jul 14 2025 18:30:55) (NTS)\n", + "Copyright (c) The PHP Group\n", + "Zend Engine v4.3.6, Copyright (c) Zend Technologies\n", + " with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies\n" + ] + } + ], + "source": [ + "php -v" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "9ac19af9", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio\n" + ] + } + ], + "source": [ + "lua -v" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "4fc685d2", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)\n" + ] + } + ], + "source": [ + "rustc --version" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "e1bc6e37", + "metadata": { + "vscode": { + "languageId": "shellscript" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "v22.20.0\n" + ] + } + ], + "source": [ + "node --version" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Bash", + "language": "bash", + "name": "bash" + }, + "language_info": { + "codemirror_mode": "shell", + "file_extension": ".sh", + "mimetype": "text/x-sh", + "name": "bash" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}