Update Dockerfile
Browse files- Dockerfile +18 -16
Dockerfile
CHANGED
|
@@ -1,15 +1,17 @@
|
|
| 1 |
-
# Use Python 3.9-slim as base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
#
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
-
PYTHONUNBUFFERED=1
|
| 7 |
-
SCRAPELY_DISABLE_C_EXTENSIONS=1
|
| 8 |
|
| 9 |
-
#
|
|
|
|
|
|
|
|
|
|
| 10 |
WORKDIR /home/user/app
|
| 11 |
|
| 12 |
-
# Install system dependencies
|
| 13 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 14 |
git \
|
| 15 |
git-lfs \
|
|
@@ -22,7 +24,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 22 |
&& rm -rf /var/lib/apt/lists/* \
|
| 23 |
&& git lfs install
|
| 24 |
|
| 25 |
-
# Upgrade pip and install
|
| 26 |
RUN pip install --upgrade pip && \
|
| 27 |
pip install --no-cache-dir \
|
| 28 |
datasets \
|
|
@@ -32,23 +34,23 @@ RUN pip install --upgrade pip && \
|
|
| 32 |
"click<8.1" \
|
| 33 |
"pydantic~=1.0"
|
| 34 |
|
| 35 |
-
# Copy your requirements file
|
| 36 |
COPY requirements.txt .
|
| 37 |
|
| 38 |
-
#
|
| 39 |
-
#
|
|
|
|
| 40 |
#
|
| 41 |
# scrapely==0.13.2
|
| 42 |
#
|
| 43 |
-
#
|
| 44 |
-
RUN pip install --no-cache-dir -
|
| 45 |
-
pip install --no-cache-dir -r requirements.txt
|
| 46 |
|
| 47 |
-
# Copy the rest of your application code
|
| 48 |
COPY . .
|
| 49 |
|
| 50 |
-
#
|
| 51 |
EXPOSE 8501
|
| 52 |
|
| 53 |
-
# Set the default command
|
| 54 |
CMD ["python", "app.py"]
|
|
|
|
| 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 \
|
|
|
|
| 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 \
|
|
|
|
| 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"]
|