Skip to content

Commit 7b14427

Browse files
committed
Refactor supervisor to s6-overlay
1 parent bf59874 commit 7b14427

File tree

18 files changed

+111
-59
lines changed

18 files changed

+111
-59
lines changed

Containerfile

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,64 @@
11
ARG DEBIAN_VERSION=bookworm
22
ARG EASY_NOVNC_VERSION=v1.1.0
33
ARG GO_VERSION=1.23
4+
ARG S6_OVERLAY_VERSION=3.2.0.0
5+
ARG STARTUP_TIMEOUT=30
46

5-
FROM golang:${GO_VERSION}-${DEBIAN_VERSION} AS build-easy-novnc
7+
FROM debian:${DEBIAN_VERSION}-slim AS base
8+
9+
ARG S6_OVERLAY_VERSION
10+
11+
ARG BUILD_DEPS=" \
12+
wget \
13+
xz-utils \
14+
"
15+
16+
RUN apt update -y \
17+
&& apt install -y $BUILD_DEPS \
18+
&& case "$(uname -m)" in \
19+
aarch64|arm*) \
20+
S6_OVERLAY_ARCHITECTURE="aarch64" \
21+
;; x86_64) \
22+
S6_OVERLAY_ARCHITECTURE="x86_64" \
23+
;; *) echo "Unsupported architecture: $(uname -m)"; exit 1; ;; \
24+
esac \
25+
&& wget -qO- "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \
26+
| tar -xpJf- -C / \
27+
&& wget -qO- "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCHITECTURE}.tar.xz" \
28+
| tar -xpJf- -C / \
29+
&& apt remove -y $BUILD_DEPS
30+
31+
FROM golang:${GO_VERSION}-${DEBIAN_VERSION} AS easy-novnc
632

733
ARG EASY_NOVNC_VERSION
834

9-
WORKDIR /src
35+
WORKDIR /build/easy-novnc/
1036

1137
RUN go mod init build \
1238
&& go get github.com/geek1011/easy-novnc@${EASY_NOVNC_VERSION} \
13-
&& go build -o /bin/easy-novnc github.com/geek1011/easy-novnc
39+
&& go build -o /build/easy-novnc/bin/ github.com/geek1011/easy-novnc
1440

15-
FROM debian:${DEBIAN_VERSION}-slim
41+
FROM base
1642

17-
RUN apt update \
18-
&& apt install -y --no-install-recommends \
43+
RUN apt update -y \
44+
&& apt install -y \
1945
breeze \
20-
ca-certificates \
2146
dbus-x11 \
22-
gosu \
2347
graphviz \
2448
kcachegrind \
2549
openbox \
26-
supervisor \
2750
tigervnc-standalone-server \
28-
xdg-utils \
29-
&& rm -rf /var/lib/apt/lists \
30-
&& mkdir -p /usr/share/desktop-directories
51+
xdg-utils
52+
53+
COPY --from=easy-novnc /build/easy-novnc/bin/ /usr/local/bin/
3154

32-
COPY --from=build-easy-novnc /bin/easy-novnc /usr/local/bin/
55+
COPY /rootfs/ /
3356

34-
ADD rootfs /
57+
ARG STARTUP_TIMEOUT
58+
ENV STARTUP_TIMEOUT="$STARTUP_TIMEOUT"
3559

36-
RUN groupadd --gid 1000 app \
37-
&& useradd --home-dir /data --shell /bin/bash --uid 1000 --gid 1000 app \
38-
&& mkdir -p /data
60+
ENTRYPOINT ["/entrypoint.sh"]
3961

4062
EXPOSE 80
4163

4264
VOLUME /data
43-
44-
CMD ["sh", "-c", "chown app:app /data /dev/stdout && exec gosu app supervisord"]

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ setup:
33

44
up: PORT = 8080
55
up:
6-
@docker run --rm -p $(PORT):80 --name kcachegrind \
6+
@docker run --rm -p $(PORT):6080 --name kcachegrind \
77
kcachegrind

rootfs/entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env sh
2+
3+
: ${STARTUP_TIMEOUT}
4+
5+
exec env -i \
6+
S6_CMD_WAIT_FOR_SERVICES_MAXTIME="$(( $STARTUP_TIMEOUT * 1000 ))" \
7+
S6_STAGE2_HOOK="/usr/sbin/s6-stage2-hook" \
8+
/init

rootfs/etc/s6-overlay/s6-rc.d/easy-novnc/dependencies.d/xvnc

Whitespace-only changes.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env sh
2+
3+
exec /usr/local/bin/easy-novnc \
4+
--addr=":6080" \
5+
--host="127.0.0.1" \
6+
--no-url-password \
7+
--novnc-params="resize=remote" \
8+
--port="5900"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun

rootfs/etc/s6-overlay/s6-rc.d/kcachegrind/dependencies.d/openbox

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env sh
2+
3+
export $(/usr/bin/dbus-launch)
4+
export DISPLAY=:0
5+
export HOME=/data
6+
7+
exec /usr/bin/kcachegrind
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
longrun

rootfs/etc/s6-overlay/s6-rc.d/openbox/dependencies.d/xvnc

Whitespace-only changes.

0 commit comments

Comments
 (0)