broadfield-dev commited on
Commit
079a0c1
·
verified ·
1 Parent(s): 8d9397e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -16
Dockerfile CHANGED
@@ -1,11 +1,13 @@
1
- # Use Ubuntu 22.04 as the base image for stability and compatibility
2
  FROM ubuntu:22.04
3
 
4
- # Set environment variables to avoid interactive prompts during installation
5
  ENV DEBIAN_FRONTEND=noninteractive
6
  ENV DISPLAY=:99
 
 
 
 
 
7
 
8
- # Install system dependencies for pygobject, toga, and Xvfb
9
  RUN apt-get update && apt-get install -y \
10
  python3 \
11
  python3-dev \
@@ -18,25 +20,22 @@ RUN apt-get update && apt-get install -y \
18
  ninja-build \
19
  libgtk-3-dev \
20
  xvfb \
 
 
 
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
- # Create a working directory
24
- WORKDIR /app
25
-
26
- # Copy the Flask app code
27
- COPY app.py /app/
28
- COPY templates /app/templates/
29
 
30
- # Create and activate a virtual environment
31
  RUN python3 -m venv /venv
32
  ENV PATH="/venv/bin:$PATH"
33
 
34
- # Install Python dependencies
35
- RUN pip install --upgrade pip && \
36
  pip install flask pygobject toga
37
 
38
- # Expose port 5000 for Flask
39
- EXPOSE 7860
40
 
41
- # Start Xvfb and run the Flask app
42
- CMD Xvfb :99 -screen 0 1024x768x16 & python3 app.py
 
 
 
 
1
  FROM ubuntu:22.04
2
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
  ENV DISPLAY=:99
5
+ ENV PATH="/home/user/.local/bin:$PATH"
6
+
7
+ RUN useradd -m -u 1000 user
8
+ USER user
9
+ WORKDIR /app
10
 
 
11
  RUN apt-get update && apt-get install -y \
12
  python3 \
13
  python3-dev \
 
20
  ninja-build \
21
  libgtk-3-dev \
22
  xvfb \
23
+ x11vnc \
24
+ novnc \
25
+ websockify \
26
  && rm -rf /var/lib/apt/lists/*
27
 
28
+ COPY --chown=user . /app
 
 
 
 
 
29
 
 
30
  RUN python3 -m venv /venv
31
  ENV PATH="/venv/bin:$PATH"
32
 
33
+ RUN pip install --no-cache-dir --upgrade pip && \
 
34
  pip install flask pygobject toga
35
 
36
+ EXPOSE 7860 6080
 
37
 
38
+ CMD Xvfb :99 -screen 0 1024x768x16 & \
39
+ x11vnc -display :99 -forever -nopw & \
40
+ websockify --web /usr/share/novnc 6080 localhost:5900 & \
41
+ python3 app.py