diff --git a/.forgejo/workflows/jupyter.yml b/.forgejo/workflows/jupyter.yml new file mode 100644 index 0000000..213fe0b --- /dev/null +++ b/.forgejo/workflows/jupyter.yml @@ -0,0 +1,66 @@ +# Workflow name +name: Build and Push Jupider Container + +# Run-name for each workflow run +run-name: Build and Push Jupider Container +on: + push: + branches: + - main + paths: + - 'containers/jupider/**' + - '.forgejo/workflows/jupider.yml' + workflow_dispatch: {} + schedule: + - cron: '0 20 * * 5' # Runs every Friday at 8 PM UTC + +env: + CONTAINER_NAME: jupider + # USER: ${{ github.actor }} + USER: hbms + +jobs: + build-and-push-arch: + runs-on: ${{ matrix.arch }} + strategy: + matrix: + arch: [ amd64, arm64 ] + container: + image: ghcr.io/catthehacker/ubuntu:act-22.04 + steps: + - name: Prepare environment variables + run: | + echo "$HOME/.local/bin" >> "$GITHUB_PATH" + echo REGISTRY=${{ vars.REGISTRY }} >> $GITHUB_ENV + + - name: Checkout the repo + uses: actions/checkout@v4 + + - name: Login to the registry + uses: docker/login-action@v3 + with: + registry: ${{ vars.REGISTRY }} + username: ${{ env.USER }} + password: ${{ secrets.PACKAGE_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: ./containers/jupider/ + file: ./containers/jupider/Dockerfile + push: true + provenance: false + tags: ${{ vars.REGISTRY }}/${{ env.USER }}/${{ env.CONTAINER_NAME }}-${{ matrix.arch }}:latest + + merge-images-via-manifest: + runs-on: amd64 + needs: build-and-push-arch + container: + image: ghcr.io/catthehacker/ubuntu:act-22.04 + steps: + - name: Generate and push multi-arch manifest + run: | + echo REGISTRY=${{ vars.REGISTRY }} >> $GITHUB_ENV + echo ${{ secrets.PACKAGE_TOKEN }} | docker login ${{ vars.REGISTRY }} -u ${USER} --password-stdin + docker manifest create ${{ vars.REGISTRY }}/${USER}/${{ env.CONTAINER_NAME }}:latest ${{ vars.REGISTRY }}/${USER}/${{ env.CONTAINER_NAME }}-amd64:latest ${{ vars.REGISTRY }}/${USER}/${{ env.CONTAINER_NAME }}-arm64:latest + docker manifest push ${{ vars.REGISTRY }}/${USER}/${{ env.CONTAINER_NAME }}:latest diff --git a/containers/jupyter/Dockerfile b/containers/jupyter/Dockerfile new file mode 100644 index 0000000..886af4d --- /dev/null +++ b/containers/jupyter/Dockerfile @@ -0,0 +1,19 @@ +FROM continuumio/miniconda3 + + +RUN /opt/conda/bin/conda install jupyter -y --quiet +RUN mkdir -p /opt/notebooks +RUN chown -R root:root /opt/notebooks + +# Set working dir and expose the same port as your compose file (80) +WORKDIR /opt/notebooks +VOLUME ["/opt/notebooks"] +EXPOSE 80 + +# Start jupyter on port 80 and keep logs in /root/jupyter.log +ENTRYPOINT ["/bin/bash", "-c", "/opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=80 --no-browser --allow-root > /root/jupyter.log 2>&1"] + + + + +