Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
98 lines (86 loc) · 3.85 KB
/
Copy pathDockerfile
File metadata and controls
98 lines (86 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# CupCarbon Klines (JavaFX, requires Java 24) in a portable, GUI-capable
# container. GUI is exposed over noVNC (browser-based VNC) so it works
# identically on Linux, macOS, and Windows hosts without X11-forwarding setup.
FROM ubuntu:22.04
LABEL description="CupCarbon Klines WSN/IoT simulator - portable container with noVNC GUI access"
ENV DEBIAN_FRONTEND=noninteractive \
DISPLAY=:1 \
RESOLUTION=1600x900x24 \
VNC_PORT=5900 \
NOVNC_PORT=6080
# --- Java 24 -------------------------------------------------------------
# CupCarbon Klines requires Java 23 or 24 specifically. Neither is an
# actively-maintained eclipse-temurin Docker Hub tag anymore (both are
# non-LTS releases already superseded by 25 LTS), so instead of depending on
# a base-image tag that can disappear, we pull the exact JDK build directly
# from Adoptium's stable release API.
RUN apt-get update && apt-get install -y --no-install-recommends \
wget ca-certificates \
&& wget -q -O /tmp/jdk.tar.gz \
"https://api.adoptium.net/v3/binary/latest/24/ga/linux/x64/jdk/hotspot/normal/eclipse?project=jdk" \
&& mkdir -p /opt/java \
&& tar -xzf /tmp/jdk.tar.gz -C /opt/java --strip-components=1 \
&& rm /tmp/jdk.tar.gz \
&& rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME=/opt/java
ENV PATH="${JAVA_HOME}/bin:${PATH}"
# --- System deps -------------------------------------------------------
# xvfb : virtual framebuffer (headless X server the JavaFX app draws into)
# fluxbox : lightweight window manager (needed so JavaFX windows behave, e.g. resize/focus)
# x11vnc : exposes the Xvfb display over VNC
# novnc/websockify : browser-based VNC client, served over HTTP
# libgl1, libxrender1, libxtst6, libxi6, fonts-dejavu : common JavaFX/Swing runtime deps
# libgtk-3-0 + friends : JavaFX's "Glass" windowing toolkit requires GTK to
# actually create windows on Linux - without it, JavaFX throws
# "Unable to load glass GTK library" even though rendering itself works
RUN apt-get update && apt-get install -y --no-install-recommends \
xvfb \
fluxbox \
x11vnc \
novnc \
websockify \
xterm \
unzip \
wget \
ca-certificates \
supervisor \
libgl1 \
libxrender1 \
libxtst6 \
libxi6 \
fonts-dejavu \
x11-utils \
python3 \
python3-pip \
libgtk-3-0 \
libgdk-pixbuf2.0-0 \
libpango-1.0-0 \
libcairo2 \
libatk1.0-0 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# --- CupCarbon itself ----------------------------------------------------
# Because cupcarbon.com blocks automated downloads (bot detection), the zip
# must be downloaded by hand and placed at ./cupcarbon-src/cupcarbon.zip
# *before* building this image.
#
# Get the real, pre-built "CupCarbon Klines" package from:
# http://cupcarbon.com/download_klines.php
# Pick the "Linux x64" package (NOT GitHub's "Download ZIP", which only gives
# raw source code with no compiled jar). See README.md for details.
WORKDIR /opt/cupcarbon
COPY cupcarbon-src/cupcarbon.zip /tmp/cupcarbon.zip
RUN unzip -q /tmp/cupcarbon.zip -d /opt/cupcarbon \
&& rm /tmp/cupcarbon.zip \
&& chmod +x /opt/cupcarbon/*.jar 2>/dev/null || true
# Persist user projects/simulations outside the container's writable layer
RUN mkdir -p /opt/cupcarbon/projects
VOLUME ["/opt/cupcarbon/projects"]
# --- noVNC static files (websockify serves these) -----------------------
RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
# --- Supervisor: run Xvfb, fluxbox, x11vnc, websockify, and CupCarbon ---
COPY supervisord.conf /etc/supervisor/conf.d/cupcarbon.conf
COPY start-cupcarbon.sh /opt/cupcarbon/start-cupcarbon.sh
RUN chmod +x /opt/cupcarbon/start-cupcarbon.sh
EXPOSE 6080 5900
ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]