1
+ # Use the base image with VNC and Xubuntu
2
+ FROM accetto/xubuntu-vnc-novnc:latest
3
+
4
+ # Ensure apt-get runs with root privileges
5
+ USER root
6
+
7
+ # Fix potential directory permissions issue before running apt-get
8
+ RUN mkdir -p /var/lib/apt/lists/partial
9
+
10
+ # Set environment variables for Java
11
+ ENV JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
12
+ ENV PATH="$JAVA_HOME/bin:$PATH"
13
+ ENV DISPLAY=:1
14
+ ENV QT_DEBUG_PLUGINS=1
15
+ ENV QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms
16
+
17
+ # Prepend to LD_LIBRARY_PATH
18
+ ENV LD_LIBRARY_PATH=/opt/CoppeliaSim_Pro_V4_1_0_Ubuntu18_04/programming/remoteApiBindings/java/lib/Ubuntu18_04:$LD_LIBRARY_PATH
19
+
20
+ # Prepend to JAVA_LIBRARY_PATH
21
+ ENV JAVA_LIBRARY_PATH=/opt/CoppeliaSim_Pro_V4_1_0_Ubuntu18_04/programming/remoteApiBindings/java/lib/Ubuntu18_04:$JAVA_LIBRARY_PATH
22
+
23
+ # Install Java, necessary dependencies, and CoppeliaSim
24
+ RUN apt-get update && \
25
+ apt-get install -y \
26
+ openjdk-11-jdk \
27
+ wget \
28
+ libx11-6 \
29
+ libglu1-mesa \
30
+ libxi6 \
31
+ libxmu6 \
32
+ libpng16-16 \
33
+ fontconfig \
34
+ libfreetype6 \
35
+ qt5-qmake qtbase5-dev qtbase5-dev-tools \
36
+ libqt5core5a libqt5gui5 libqt5widgets5 \
37
+ libxcb1 libx11-xcb1 libxcb-glx0 \
38
+ libxcb-util1 libxcb-icccm4 libxcb-image0 \
39
+ libxcb-keysyms1 libxcb-render-util0 \
40
+ libxcb-xinerama0 libxcb-randr0 \
41
+ libxcb-shm0 libxcb-shape0 \
42
+ libavcodec-dev \
43
+ libavformat-dev \
44
+ libswscale-dev \
45
+ && rm -rf /var/lib/apt/lists/*
46
+
47
+
48
+ # Install CoppeliaSim (V-REP) in a known location
49
+ RUN wget -q https://downloads.coppeliarobotics.com/V4_1_0/CoppeliaSim_Pro_V4_1_0_Ubuntu18_04.tar.xz -O /tmp/coppeliasim.tar.xz && \
50
+ tar -xvf /tmp/coppeliasim.tar.xz -C /opt && \
51
+ rm /tmp/coppeliasim.tar.xz
52
+
53
+ # Expose the VNC port (5901) and the HTTP port (8080) for noVNC
54
+ EXPOSE 5901 8080
55
+
56
+ # Set the working directory
57
+ WORKDIR /root
58
+
59
+ # Copy the local files into the container
60
+ COPY . /root/rl_CSR
61
+
62
+ # Ensure the group 'headless' exists (if not, create it), and the user 'headless' exists
63
+ RUN getent group headless || groupadd -g 1000 headless && \
64
+ id -u headless || true
65
+
66
+ # Change ownership of /home/headless to the 'headless' user and group
67
+ RUN chown -R headless:headless /home/headless
68
+
69
+
70
+ # 1. Start VNC server
71
+ # CMD bash -c "../dockerstartup/vnc_startup.sh"
72
+
73
+ # 2. Run CoppeliaSim in the background
74
+ # RUN /opt/CoppeliaSim_Pro_V4_1_0_Ubuntu18_04/coppeliaSim.sh /root/rl_CSR/scenes/training_obj2.ttt &
75
+
76
+ # 3. Sleep and wait for CoppeliaSim to load (adjust the sleep time if necessary)
77
+ # RUN sleep 10
78
+
79
+ # 4. Build and run Java application using Gradle
80
+ # RUN cd /root/rl_CSR && JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 ./gradlew --configure-on-demand -x check run
0 commit comments