euler314 commited on
Commit
b37688c
·
verified ·
1 Parent(s): 6b715f0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -40
Dockerfile CHANGED
@@ -1,56 +1,37 @@
1
  # Use Python 3.9-slim as the base image.
2
  FROM python:3.9-slim
3
 
4
- # Disable .pyc generation and enable unbuffered stdout.
5
- ENV PYTHONDONTWRITEBYTECODE=1 \
6
- PYTHONUNBUFFERED=1
 
 
7
 
8
- # Tell Scrapely to disable its C extensions (if supported).
9
- ENV SCRAPELY_DISABLE_C_EXTENSIONS=1
10
 
11
- # Set the working directory.
12
  WORKDIR /home/user/app
13
 
14
- # Install system dependencies.
15
- RUN apt-get update && apt-get install -y --no-install-recommends \
16
- git \
17
- git-lfs \
18
- ffmpeg \
19
- libsm6 \
20
- libxext6 \
21
- cmake \
22
- rsync \
23
- libgl1-mesa-glx \
24
- && rm -rf /var/lib/apt/lists/* \
25
- && git lfs install
26
-
27
- # Upgrade pip and install common packages.
28
  RUN pip install --upgrade pip && \
29
- pip install --no-cache-dir \
30
- datasets \
31
- "huggingface-hub>=0.19" \
32
- "hf-transfer>=0.1.4" \
33
- "protobuf<4" \
34
- "click<8.1" \
35
- "pydantic~=1.0"
36
-
37
- # Copy your requirements file.
38
  COPY requirements.txt .
39
 
40
- # IMPORTANT:
41
- # Ensure your requirements.txt pins Scrapely to a compatible (or pure-Python) version.
42
- # For example, include a line like:
43
- #
44
- # scrapely==0.13.2
45
- #
46
- # Then install your Python dependencies.
47
  RUN pip install --no-cache-dir -r requirements.txt
48
 
49
- # Copy the rest of your application code.
50
  COPY . .
51
 
52
- # If your app listens on a specific port (e.g. for Streamlit), expose that port.
 
 
 
53
  EXPOSE 8501
54
 
55
- # Set the default command (adjust as needed).
56
- CMD ["python3", "app.py"]
 
1
  # Use Python 3.9-slim as the base image.
2
  FROM python:3.9-slim
3
 
4
+ # Install system dependencies
5
+ RUN apt-get update && apt-get install -y \
6
+ git git-lfs ffmpeg libsm6 libxext6 cmake rsync libgl1-mesa-glx && \
7
+ rm -rf /var/lib/apt/lists/* && \
8
+ git lfs install
9
 
10
+ # Create a non-root user (if needed)
11
+ RUN useradd -m -u 1000 user
12
 
 
13
  WORKDIR /home/user/app
14
 
15
+ # Upgrade pip and install common packages
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  RUN pip install --upgrade pip && \
17
+ pip install --no-cache-dir datasets "huggingface-hub>=0.19" "hf-transfer>=0.1.4" "protobuf<4" "click<8.1" "pydantic~=1.0"
18
+
19
+ # Set Playwright browsers path to local folder
20
+ ENV PLAYWRIGHT_BROWSERS_PATH=0
21
+
22
+ # Copy your requirements file
 
 
 
23
  COPY requirements.txt .
24
 
25
+ # Install project dependencies
 
 
 
 
 
 
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
+ # Copy the rest of your application code
29
  COPY . .
30
 
31
+ # Optionally, run playwright install (if your app depends on it)
32
+ RUN python -m playwright install chromium
33
+
34
+ # Expose the port your app uses (for example, 8501 for Streamlit)
35
  EXPOSE 8501
36
 
37
+ CMD ["python", "app.py"]