SalHargis commited on
Commit
1126f67
·
verified ·
1 Parent(s): 14ef2c5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -14
Dockerfile CHANGED
@@ -1,8 +1,14 @@
1
- # USE SPECIFIC VERSION (Fixes the missing file crash)
2
- FROM python:3.9-bullseye
 
3
 
4
- # 1. Install system dependencies
 
 
 
5
  RUN apt-get update && apt-get install -y \
 
 
6
  python3-tk \
7
  xvfb \
8
  x11vnc \
@@ -10,39 +16,41 @@ RUN apt-get update && apt-get install -y \
10
  novnc \
11
  net-tools \
12
  scrot \
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # 2. Fix the 403 Error (Missing Index)
16
- # Force NoVNC to show the viewer by default
17
  RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
18
 
19
- # 3. Set up work directory
20
  WORKDIR /app
21
 
22
- # 4. Copy your python files
23
  COPY . .
24
 
25
- # 5. Install Python requirements
26
- RUN pip install --no-cache-dir -r requirements.txt
 
27
 
28
- # 6. Create the user
29
  RUN useradd -m -u 1000 user
30
 
31
- # 7. GENERATE STARTUP SCRIPT (Fixes permissions & line endings)
 
32
  RUN echo '#!/bin/bash' > start.sh && \
33
  echo 'export DISPLAY=:1' >> start.sh && \
34
  echo 'Xvfb :1 -screen 0 1440x960x24 &' >> start.sh && \
35
  echo 'sleep 2' >> start.sh && \
36
  echo 'fluxbox &' >> start.sh && \
37
- echo 'python main.py &' >> start.sh && \
38
  echo 'x11vnc -display :1 -nopw -forever -quiet &' >> start.sh && \
39
  echo '/usr/share/novnc/utils/launch.sh --vnc localhost:5900 --listen 7860' >> start.sh && \
40
  chmod +x start.sh
41
 
42
- # 8. Transfer ownership to user
43
  RUN chown -R user:user /app
44
 
45
- # 9. Switch to user and run
46
  USER user
47
  ENV HOME=/home/user \
48
  PATH=/home/user/.local/bin:$PATH
 
1
+ # 1. Use Debian Bullseye (Stable Linux) instead of the Python image
2
+ # This ensures Python and Tkinter versions match perfectly.
3
+ FROM debian:bullseye
4
 
5
+ # 2. Prevent interactive prompts during installation
6
+ ENV DEBIAN_FRONTEND=noninteractive
7
+
8
+ # 3. Install Python, Tkinter, and GUI tools all from the system package manager
9
  RUN apt-get update && apt-get install -y \
10
+ python3 \
11
+ python3-pip \
12
  python3-tk \
13
  xvfb \
14
  x11vnc \
 
16
  novnc \
17
  net-tools \
18
  scrot \
19
+ dos2unix \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
+ # 4. Fix the 403 Error (Missing Index)
 
23
  RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
24
 
25
+ # 5. Set up work directory
26
  WORKDIR /app
27
 
28
+ # 6. Copy files
29
  COPY . .
30
 
31
+ # 7. Install Python requirements
32
+ # We use --break-system-packages because we are intentionally using the system python
33
+ RUN pip3 install --no-cache-dir --break-system-packages -r requirements.txt
34
 
35
+ # 8. Create the user (ID 1000)
36
  RUN useradd -m -u 1000 user
37
 
38
+ # 9. GENERATE STARTUP SCRIPT
39
+ # We explicitly call 'python3' here
40
  RUN echo '#!/bin/bash' > start.sh && \
41
  echo 'export DISPLAY=:1' >> start.sh && \
42
  echo 'Xvfb :1 -screen 0 1440x960x24 &' >> start.sh && \
43
  echo 'sleep 2' >> start.sh && \
44
  echo 'fluxbox &' >> start.sh && \
45
+ echo 'python3 main.py &' >> start.sh && \
46
  echo 'x11vnc -display :1 -nopw -forever -quiet &' >> start.sh && \
47
  echo '/usr/share/novnc/utils/launch.sh --vnc localhost:5900 --listen 7860' >> start.sh && \
48
  chmod +x start.sh
49
 
50
+ # 10. Fix permissions
51
  RUN chown -R user:user /app
52
 
53
+ # 11. Switch to user and run
54
  USER user
55
  ENV HOME=/home/user \
56
  PATH=/home/user/.local/bin:$PATH