Skip to content

Commit

Permalink
Merge pull request #94 from consideRatio/pr/turbovnc
Browse files Browse the repository at this point in the history
Publish TigerVNC and TurboVNC image to quay.io
  • Loading branch information
consideRatio authored Feb 28, 2024
2 parents 8ce6ff5 + 8842159 commit f780833
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 4 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,75 @@ jobs:
- name: publish to pypi
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags/')

publish-images:
runs-on: ubuntu-22.04

strategy:
fail-fast: false
matrix:
include:
- vncserver: tigervnc
- vncserver: turbovnc

steps:
- uses: actions/checkout@v4

- name: Set up QEMU (for docker buildx)
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx (for multi-arch builds)
uses: docker/setup-buildx-action@v3

- name: Make decisions on pushing and suffix (based on vnc server chosen)
id: decisions
run: |
if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main') }}" = "true" ]; then
echo "push=true" >> $GITHUB_OUTPUT
else
echo "push=false" >> $GITHUB_OUTPUT
fi
# We provide image tags with -tigervnc and -turbovnc suffixes to allow
# for an explicit choice, but also ship with a default choice of
# TigerVNC.
if [ "${{ matrix.vncserver == 'tigervnc' }}" == "true" ]; then
echo "suffix=<empty-string>,-${{ matrix.vncserver }}" >> $GITHUB_OUTPUT
else
echo "suffix=-${{ matrix.vncserver }}" >> $GITHUB_OUTPUT
fi
# For builds triggered by a git tag 1.2.3, we calculate image tags like:
# [{prefix}:1.2.3, {prefix}:1.2, {prefix}:1, {prefix}:latest]
#
# More details at
# https:/jupyterhub/action-major-minor-tag-calculator.
#
- name: Get image tags
id: tags
uses: jupyterhub/action-major-minor-tag-calculator@v3
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
prefix: "quay.io/jupyterhub/jupyter-remote-desktop-proxy:"
suffix: ${{ steps.decisions.outputs.suffix }}
branchRegex: ^\w[\w-.]*$
defaultTag: quay.io/jupyterhub/jupyter-remote-desktop-proxy:noref

- name: Login to container registry
# Credentials to Quay.io was setup by...
# 1. Creating a [Robot Account](https://quay.io/organization/jupyterhub?tab=robots)
# 2. Giving it push permissions to the image repository
# 3. Adding Robot Account credentials as workflow environment secrets
if: steps.decisions.outputs.push == 'true'
run: |
docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
- name: Build and push image
uses: docker/build-push-action@v5
with:
build-args: |
vncserver=${{ matrix.vncserver }}
context: .
platforms: linux/amd64,linux/arm64
push: ${{ steps.decisions.outputs.push }}
tags: ${{ join(fromJson(steps.tags.outputs.tags)) }}
16 changes: 14 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,29 @@ jobs:
container:
runs-on: ubuntu-22.04
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
include:
- vncserver: tigervnc
- vncserver: turbovnc

steps:
- uses: actions/checkout@v4

- name: Build image
run: |
docker build -t jupyter-remote-desktop-proxy .
docker build --build-arg vncserver=${{ matrix.vncserver }} -t jupyter-remote-desktop-proxy .
- name: Smoke test image
run: |
docker run -d -p 8888:8888 -e JUPYTER_TOKEN=secret jupyter-remote-desktop-proxy
container_id=$(docker run -d -p 8888:8888 -e JUPYTER_TOKEN=secret jupyter-remote-desktop-proxy)
# -help flag is only available for TigerVNC, where TurboVNC can't
# print info without returning an error code.
docker exec $container_id vncserver -help || true
docker exec $container_id vncserver -list
sleep 10
curl 'http://localhost:8888/desktop/?token=secret' | grep 'Jupyter Remote Desktop Proxy'
# Test if the built JS file is present in the image
Expand Down
27 changes: 25 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ RUN apt-get -y -qq update \
xorg \
xubuntu-icon-theme \
fonts-dejavu \
tigervnc-standalone-server \
tigervnc-xorg-extension \
# Disable the automatic screenlock since the account password is unknown
&& apt-get -y -qq remove xfce4-screensaver \
# chown $HOME to workaround that the xorg installation creates a
Expand All @@ -23,6 +21,31 @@ RUN apt-get -y -qq update \
&& chown -R $NB_UID:$NB_GID $HOME /opt/install \
&& rm -rf /var/lib/apt/lists/*

# Install a VNC server, either TigerVNC (default) or TurboVNC
ARG vncserver=tigervnc
RUN if [ "${vncserver}" = "tigervnc" ]; then \
echo "Installing TigerVNC"; \
apt-get -y -qq update; \
apt-get -y -qq install \
tigervnc-standalone-server \
tigervnc-xorg-extension \
; \
rm -rf /var/lib/apt/lists/*; \
fi
ENV PATH=/opt/TurboVNC/bin:$PATH
RUN if [ "${vncserver}" = "turbovnc" ]; then \
echo "Installing TurboVNC"; \
# Install instructions from https://turbovnc.org/Downloads/YUM
wget -q -O- https://packagecloud.io/dcommander/turbovnc/gpgkey | \
gpg --dearmor >/etc/apt/trusted.gpg.d/TurboVNC.gpg; \
wget -O /etc/apt/sources.list.d/TurboVNC.list https://raw.githubusercontent.com/TurboVNC/repo/main/TurboVNC.list; \
apt-get -y -qq update; \
apt-get -y -qq install \
turbovnc \
; \
rm -rf /var/lib/apt/lists/*; \
fi

USER $NB_USER

# Install the environment first, and then install the package separately for faster rebuilds
Expand Down

0 comments on commit f780833

Please sign in to comment.