Spaces:
Running
Running
Tecnhotron
commited on
Commit
·
26e4605
1
Parent(s):
13fb640
First
Browse files- Dockerfile +5 -1
- api.py +0 -4
Dockerfile
CHANGED
@@ -4,10 +4,14 @@ RUN useradd -m -u 1000 user
|
|
4 |
USER user
|
5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
|
|
|
|
|
|
7 |
WORKDIR /app
|
8 |
|
9 |
COPY --chown=user ./requirements.txt requirements.txt
|
10 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
11 |
|
12 |
COPY --chown=user . /app
|
13 |
-
|
|
|
|
4 |
USER user
|
5 |
ENV PATH="/home/user/.local/bin:$PATH"
|
6 |
|
7 |
+
# Install Xvfb for virtual display
|
8 |
+
RUN apt-get update && apt-get install -y xvfb
|
9 |
+
|
10 |
WORKDIR /app
|
11 |
|
12 |
COPY --chown=user ./requirements.txt requirements.txt
|
13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
14 |
|
15 |
COPY --chown=user . /app
|
16 |
+
# Start Xvfb and run the application
|
17 |
+
CMD sh -c "Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & export DISPLAY=:99 && uvicorn api:app --host 0.0.0.0 --port 7860"
|
api.py
CHANGED
@@ -31,10 +31,6 @@ if platform.system() == 'Linux':
|
|
31 |
logger = logging.getLogger(__name__)
|
32 |
logger.info("Started virtual display for Linux environment")
|
33 |
|
34 |
-
# --- Logging Setup ---
|
35 |
-
# Configure logging to output to both console and a file named 'app.log'
|
36 |
-
log_file_path = "app.log"
|
37 |
-
# The 'force=True' argument is used to reconfigure the root logger
|
38 |
logging.basicConfig(
|
39 |
level=logging.INFO,
|
40 |
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|
|
|
31 |
logger = logging.getLogger(__name__)
|
32 |
logger.info("Started virtual display for Linux environment")
|
33 |
|
|
|
|
|
|
|
|
|
34 |
logging.basicConfig(
|
35 |
level=logging.INFO,
|
36 |
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
|