Update Dockerfile
Browse files- Dockerfile +27 -11
Dockerfile
CHANGED
|
@@ -1,12 +1,15 @@
|
|
| 1 |
-
# Use Python 3.
|
| 2 |
-
FROM python:3.
|
| 3 |
|
| 4 |
-
# Disable .pyc
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
PYTHONUNBUFFERED=1
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
# Set the working directory.
|
| 9 |
-
WORKDIR /app
|
| 10 |
|
| 11 |
# Install system dependencies.
|
| 12 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -22,19 +25,32 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 22 |
&& git lfs install
|
| 23 |
|
| 24 |
# Upgrade pip and install common packages.
|
| 25 |
-
RUN pip install --upgrade pip
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
COPY requirements.txt .
|
| 29 |
|
| 30 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 32 |
|
| 33 |
# Copy the rest of your application code.
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
-
#
|
| 37 |
EXPOSE 8501
|
| 38 |
|
| 39 |
-
# Set the default command
|
| 40 |
-
CMD ["
|
|
|
|
| 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 \
|
|
|
|
| 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 ["python", "app.py"]
|