Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +42 -0
Dockerfile
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 \
|
12 |
+
python3-pip \
|
13 |
+
python3-venv \
|
14 |
+
libgirepository1.0-dev \
|
15 |
+
libcairo2-dev \
|
16 |
+
pkg-config \
|
17 |
+
meson \
|
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 5000
|
40 |
+
|
41 |
+
# Start Xvfb and run the Flask app
|
42 |
+
CMD Xvfb :99 -screen 0 1024x768x16 & python3 app.py
|