From 94c474031e24f3a3306b8bf508d2f79801ca0822 Mon Sep 17 00:00:00 2001 From: Walter Oggioni Date: Fri, 11 Apr 2025 00:31:27 +0800 Subject: [PATCH] added jupyterhub image --- .gitea/workflows/build-jupyterhub.yaml | 37 ++++++++++++++++++++++++++ jupyterhub/Dockerfile | 31 +++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .gitea/workflows/build-jupyterhub.yaml create mode 100644 jupyterhub/Dockerfile diff --git a/.gitea/workflows/build-jupyterhub.yaml b/.gitea/workflows/build-jupyterhub.yaml new file mode 100644 index 0000000..c9516ea --- /dev/null +++ b/.gitea/workflows/build-jupyterhub.yaml @@ -0,0 +1,37 @@ +name: CI +on: + push: + branches: [ master ] + paths: + - 'jupyterhub/**' + - '.gitea/workflows/build-jupyterhub.yaml' +jobs: + "Build wildfly docker images": + runs-on: hostinger + steps: + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3.4.0 + with: + driver: docker-container + - + name: Login to Gitea container registry + uses: docker/login-action@v3 + with: + registry: gitea.woggioni.net + username: woggioni + password: ${{ secrets.PUBLISHER_TOKEN }} + - + name: Build and push jupyterhub images + uses: docker/build-push-action@v6 + with: + context: "{{defaultContext}}:jupyterhub" + push: true + pull: true + tags: | + "gitea.woggioni.net/woggioni/jupyterhub:latest" + "gitea.woggioni.net/woggioni/jupyterhub:5.2.1" + build-args: "VERSION=5.2.1" + cache-from: type=registry,ref=gitea.woggioni.net/woggioni/jupyterhub:buildx + cache-to: type=registry,mode=max,compression=zstd,image-manifest=true,oci-mediatypes=true,ref=gitea.woggioni.net/woggioni/jupyterhub:buildx + diff --git a/jupyterhub/Dockerfile b/jupyterhub/Dockerfile new file mode 100644 index 0000000..484e15c --- /dev/null +++ b/jupyterhub/Dockerfile @@ -0,0 +1,31 @@ +FROM alpine:latest AS base + +ARG VERSION + +RUN --mount=type=cache,target=/var/cache/apk apk update +RUN --mount=type=cache,target=/var/cache/apk apk add python3 nodejs libcurl + +RUN adduser -D -u 1000 jupyterhub +RUN mkdir -p /var/lib/jupyterhub +RUN chown jupyterhub:jupyterhub /var/lib/jupyterhub + +FROM base AS build +USER root +RUN --mount=type=cache,target=/var/cache/apk apk add npm curl-dev gcc musl-dev python3-dev +RUN --mount=type=cache,target=/home/jupyterhub/.cache/pip npm install -g configurable-http-proxy +USER jupyterhub +WORKDIR /var/lib/jupyterhub +RUN python3 -m venv . +RUN --mount=type=cache,target=/home/jupyterhub/.cache/pip ./bin/pip install "jupyterhub==${VERSION}" jupyterhub_idle_culler dockerspawner psycopg2-binary oauthenticator pycurl + + +FROM base AS release +USER root +COPY --from=build /usr/local/lib/node_modules /usr/local/lib/node_modules +RUN ln -s ../lib/node_modules/configurable-http-proxy/bin/configurable-http-proxy /usr/local/bin/configurable-http-proxy +COPY --from=build /var/lib/jupyterhub /var/lib/jupyterhub +USER jupyterhub +WORKDIR /home/jupyterhub +ENV PATH="/var/lib/jupyterhub/bin/:$PATH" +EXPOSE 43080 +ENTRYPOINT ["jupyterhub"]