Skip to content

Commit f780833

Browse files
authored
Merge pull request #94 from consideRatio/pr/turbovnc
Publish TigerVNC and TurboVNC image to quay.io
2 parents 8ce6ff5 + 8842159 commit f780833

File tree

3 files changed

+111
-4
lines changed

3 files changed

+111
-4
lines changed

.github/workflows/release.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,75 @@ jobs:
5757
- name: publish to pypi
5858
uses: pypa/gh-action-pypi-publish@release/v1
5959
if: startsWith(github.ref, 'refs/tags/')
60+
61+
publish-images:
62+
runs-on: ubuntu-22.04
63+
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
include:
68+
- vncserver: tigervnc
69+
- vncserver: turbovnc
70+
71+
steps:
72+
- uses: actions/checkout@v4
73+
74+
- name: Set up QEMU (for docker buildx)
75+
uses: docker/setup-qemu-action@v3
76+
77+
- name: Set up Docker Buildx (for multi-arch builds)
78+
uses: docker/setup-buildx-action@v3
79+
80+
- name: Make decisions on pushing and suffix (based on vnc server chosen)
81+
id: decisions
82+
run: |
83+
if [ "${{ startsWith(github.ref, 'refs/tags/') || (github.ref == 'refs/heads/main') }}" = "true" ]; then
84+
echo "push=true" >> $GITHUB_OUTPUT
85+
else
86+
echo "push=false" >> $GITHUB_OUTPUT
87+
fi
88+
89+
# We provide image tags with -tigervnc and -turbovnc suffixes to allow
90+
# for an explicit choice, but also ship with a default choice of
91+
# TigerVNC.
92+
if [ "${{ matrix.vncserver == 'tigervnc' }}" == "true" ]; then
93+
echo "suffix=<empty-string>,-${{ matrix.vncserver }}" >> $GITHUB_OUTPUT
94+
else
95+
echo "suffix=-${{ matrix.vncserver }}" >> $GITHUB_OUTPUT
96+
fi
97+
98+
# For builds triggered by a git tag 1.2.3, we calculate image tags like:
99+
# [{prefix}:1.2.3, {prefix}:1.2, {prefix}:1, {prefix}:latest]
100+
#
101+
# More details at
102+
# https://github.com/jupyterhub/action-major-minor-tag-calculator.
103+
#
104+
- name: Get image tags
105+
id: tags
106+
uses: jupyterhub/action-major-minor-tag-calculator@v3
107+
with:
108+
githubToken: ${{ secrets.GITHUB_TOKEN }}
109+
prefix: "quay.io/jupyterhub/jupyter-remote-desktop-proxy:"
110+
suffix: ${{ steps.decisions.outputs.suffix }}
111+
branchRegex: ^\w[\w-.]*$
112+
defaultTag: quay.io/jupyterhub/jupyter-remote-desktop-proxy:noref
113+
114+
- name: Login to container registry
115+
# Credentials to Quay.io was setup by...
116+
# 1. Creating a [Robot Account](https://quay.io/organization/jupyterhub?tab=robots)
117+
# 2. Giving it push permissions to the image repository
118+
# 3. Adding Robot Account credentials as workflow environment secrets
119+
if: steps.decisions.outputs.push == 'true'
120+
run: |
121+
docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
122+
123+
- name: Build and push image
124+
uses: docker/build-push-action@v5
125+
with:
126+
build-args: |
127+
vncserver=${{ matrix.vncserver }}
128+
context: .
129+
platforms: linux/amd64,linux/arm64
130+
push: ${{ steps.decisions.outputs.push }}
131+
tags: ${{ join(fromJson(steps.tags.outputs.tags)) }}

.github/workflows/test.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,29 @@ jobs:
1616
container:
1717
runs-on: ubuntu-22.04
1818
timeout-minutes: 10
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
include:
23+
- vncserver: tigervnc
24+
- vncserver: turbovnc
1925

2026
steps:
2127
- uses: actions/checkout@v4
2228

2329
- name: Build image
2430
run: |
25-
docker build -t jupyter-remote-desktop-proxy .
31+
docker build --build-arg vncserver=${{ matrix.vncserver }} -t jupyter-remote-desktop-proxy .
2632
2733
- name: Smoke test image
2834
run: |
29-
docker run -d -p 8888:8888 -e JUPYTER_TOKEN=secret jupyter-remote-desktop-proxy
35+
container_id=$(docker run -d -p 8888:8888 -e JUPYTER_TOKEN=secret jupyter-remote-desktop-proxy)
36+
37+
# -help flag is only available for TigerVNC, where TurboVNC can't
38+
# print info without returning an error code.
39+
docker exec $container_id vncserver -help || true
40+
docker exec $container_id vncserver -list
41+
3042
sleep 10
3143
curl 'http://localhost:8888/desktop/?token=secret' | grep 'Jupyter Remote Desktop Proxy'
3244
# Test if the built JS file is present in the image

Dockerfile

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ RUN apt-get -y -qq update \
1212
xorg \
1313
xubuntu-icon-theme \
1414
fonts-dejavu \
15-
tigervnc-standalone-server \
16-
tigervnc-xorg-extension \
1715
# Disable the automatic screenlock since the account password is unknown
1816
&& apt-get -y -qq remove xfce4-screensaver \
1917
# chown $HOME to workaround that the xorg installation creates a
@@ -23,6 +21,31 @@ RUN apt-get -y -qq update \
2321
&& chown -R $NB_UID:$NB_GID $HOME /opt/install \
2422
&& rm -rf /var/lib/apt/lists/*
2523

24+
# Install a VNC server, either TigerVNC (default) or TurboVNC
25+
ARG vncserver=tigervnc
26+
RUN if [ "${vncserver}" = "tigervnc" ]; then \
27+
echo "Installing TigerVNC"; \
28+
apt-get -y -qq update; \
29+
apt-get -y -qq install \
30+
tigervnc-standalone-server \
31+
tigervnc-xorg-extension \
32+
; \
33+
rm -rf /var/lib/apt/lists/*; \
34+
fi
35+
ENV PATH=/opt/TurboVNC/bin:$PATH
36+
RUN if [ "${vncserver}" = "turbovnc" ]; then \
37+
echo "Installing TurboVNC"; \
38+
# Install instructions from https://turbovnc.org/Downloads/YUM
39+
wget -q -O- https://packagecloud.io/dcommander/turbovnc/gpgkey | \
40+
gpg --dearmor >/etc/apt/trusted.gpg.d/TurboVNC.gpg; \
41+
wget -O /etc/apt/sources.list.d/TurboVNC.list https://raw.githubusercontent.com/TurboVNC/repo/main/TurboVNC.list; \
42+
apt-get -y -qq update; \
43+
apt-get -y -qq install \
44+
turbovnc \
45+
; \
46+
rm -rf /var/lib/apt/lists/*; \
47+
fi
48+
2649
USER $NB_USER
2750

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

0 commit comments

Comments
 (0)