Spaces:
Runtime error

dpadhan commited on
Commit
2f59392
·
verified ·
1 Parent(s): baadb7b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -21
Dockerfile CHANGED
@@ -1,34 +1,33 @@
1
- # Use an official Python runtime as a parent image
2
  FROM python:3.10-slim
3
 
4
- # Set environment variables
5
- ENV PYTHONDONTWRITEBYTECODE=1
6
- ENV PYTHONUNBUFFERED=1
7
-
8
- # Set the working directory in the container
9
- WORKDIR /app
10
-
11
- # Install system dependencies (optional but recommended for speedtest-cli)
12
- RUN apt-get update && apt-get install -y --no-install-recommends \
13
- build-essential \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Create a non-root user and switch to it
17
- # Hugging Face requires the container to run with UID 1000
18
  RUN useradd -m -u 1000 user
19
  USER user
20
- ENV HOME=/home/user \
21
- PATH=/home/user/.local/bin:$PATH
22
 
23
- # Copy requirements and install them
 
 
24
  COPY --chown=user requirements.txt .
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
27
- # Copy the rest of the application code
28
- COPY --chown=user . .
29
 
30
- # Expose the port Hugging Face looks for (7860)
31
- EXPOSE 7860
32
 
33
- # Command to run the bot
34
  CMD ["python", "bot.py"]
 
1
+ # Use Python 3.10
2
  FROM python:3.10-slim
3
 
4
+ # Install system dependencies for Playwright
5
+ RUN apt-get update && apt-get install -y \
6
+ libgbm-dev \
7
+ libnss3 \
8
+ libasound2 \
9
+ libxss1 \
10
+ libxtst6 \
11
+ fonts-liberation \
12
+ libgtk-3-0 \
 
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # Set up user
 
16
  RUN useradd -m -u 1000 user
17
  USER user
18
+ ENV PATH="/home/user/.local/bin:${PATH}"
 
19
 
20
+ WORKDIR /app
21
+
22
+ # Copy requirements and install
23
  COPY --chown=user requirements.txt .
24
  RUN pip install --no-cache-dir -r requirements.txt
25
 
26
+ # Install Playwright browsers
27
+ RUN playwright install chromium
28
 
29
+ # Copy the rest of the code
30
+ COPY --chown=user . .
31
 
32
+ # Run the bot
33
  CMD ["python", "bot.py"]