Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +22 -11
Dockerfile
CHANGED
|
@@ -11,29 +11,40 @@ RUN apt-get update && apt-get install -y \
|
|
| 11 |
scrot \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
# 2.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
#
|
| 18 |
COPY . .
|
| 19 |
|
| 20 |
-
#
|
| 21 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 22 |
|
| 23 |
-
#
|
| 24 |
RUN useradd -m -u 1000 user
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
RUN chown -R user:user /app
|
| 29 |
-
# Make the start script executable
|
| 30 |
-
RUN chmod +x start.sh
|
| 31 |
-
# ----------------------------
|
| 32 |
|
| 33 |
-
#
|
| 34 |
USER user
|
| 35 |
ENV HOME=/home/user \
|
| 36 |
PATH=/home/user/.local/bin:$PATH
|
| 37 |
|
| 38 |
-
# 7. Start the app
|
| 39 |
CMD ["./start.sh"]
|
|
|
|
| 11 |
scrot \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# 2. Fix the 403 Error: Create an index.html so the page loads
|
| 15 |
+
# We link the NoVNC viewer to the default index page
|
| 16 |
+
RUN ln -s /usr/share/novnc/vnc.html /usr/share/novnc/index.html
|
| 17 |
+
|
| 18 |
+
# 3. Set up work directory
|
| 19 |
WORKDIR /app
|
| 20 |
|
| 21 |
+
# 4. Copy files
|
| 22 |
COPY . .
|
| 23 |
|
| 24 |
+
# 5. Install Python requirements
|
| 25 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
+
# 6. Create the user
|
| 28 |
RUN useradd -m -u 1000 user
|
| 29 |
|
| 30 |
+
# 7. GENERATE THE STARTUP SCRIPT MANUALLY
|
| 31 |
+
# We write the script here to avoid all permission/line-ending issues
|
| 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. Fix permissions for the 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
|
| 49 |
|
|
|
|
| 50 |
CMD ["./start.sh"]
|