Update Dockerfile
Browse files- Dockerfile +46 -17
Dockerfile
CHANGED
@@ -1,37 +1,66 @@
|
|
1 |
-
# Use
|
2 |
-
FROM
|
3 |
|
4 |
-
#
|
|
|
|
|
|
|
5 |
RUN apt-get update && apt-get install -y \
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
# Create a non-root user
|
11 |
RUN useradd -m -u 1000 user
|
|
|
12 |
|
|
|
13 |
WORKDIR /home/user/app
|
14 |
|
15 |
-
#
|
|
|
|
|
|
|
|
|
16 |
RUN pip install --upgrade pip && \
|
17 |
-
pip install --no-cache-dir
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
# Set Playwright browsers
|
20 |
ENV PLAYWRIGHT_BROWSERS_PATH=0
|
21 |
|
22 |
-
# Copy
|
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 |
-
#
|
32 |
RUN python -m playwright install chromium
|
33 |
|
34 |
-
# Expose the port your
|
35 |
EXPOSE 8501
|
36 |
|
|
|
37 |
CMD ["python", "app.py"]
|
|
|
1 |
+
# Use Ubuntu 20.04 as the base image
|
2 |
+
FROM ubuntu:20.04
|
3 |
|
4 |
+
# Prevent interactive prompts during package installation
|
5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
6 |
+
|
7 |
+
# Update Ubuntu and install required packages including Python 3.10 and system dependencies
|
8 |
RUN apt-get update && apt-get install -y \
|
9 |
+
software-properties-common \
|
10 |
+
&& add-apt-repository ppa:deadsnakes/ppa \
|
11 |
+
&& apt-get update && apt-get install -y \
|
12 |
+
python3.10 \
|
13 |
+
python3.10-venv \
|
14 |
+
python3.10-dev \
|
15 |
+
git \
|
16 |
+
git-lfs \
|
17 |
+
ffmpeg \
|
18 |
+
libsm6 \
|
19 |
+
libxext6 \
|
20 |
+
cmake \
|
21 |
+
rsync \
|
22 |
+
libgl1-mesa-glx \
|
23 |
+
curl \
|
24 |
+
ca-certificates \
|
25 |
+
&& rm -rf /var/lib/apt/lists/* \
|
26 |
+
&& git lfs install
|
27 |
|
28 |
+
# Create a non-root user and switch to it
|
29 |
RUN useradd -m -u 1000 user
|
30 |
+
USER user
|
31 |
|
32 |
+
# Set working directory
|
33 |
WORKDIR /home/user/app
|
34 |
|
35 |
+
# Create and activate a virtual environment
|
36 |
+
RUN python3.10 -m venv venv
|
37 |
+
ENV PATH="/home/user/app/venv/bin:${PATH}"
|
38 |
+
|
39 |
+
# Upgrade pip and install common Python packages
|
40 |
RUN pip install --upgrade pip && \
|
41 |
+
pip install --no-cache-dir \
|
42 |
+
datasets \
|
43 |
+
"huggingface-hub>=0.19" \
|
44 |
+
"hf-transfer>=0.1.4" \
|
45 |
+
"protobuf<4" \
|
46 |
+
"click<8.1" \
|
47 |
+
"pydantic~=1.0"
|
48 |
|
49 |
+
# Set environment variable so that Playwright installs browsers in a local folder
|
50 |
ENV PLAYWRIGHT_BROWSERS_PATH=0
|
51 |
|
52 |
+
# Copy the requirements file and install project dependencies
|
53 |
+
COPY --chown=user:user requirements.txt .
|
|
|
|
|
54 |
RUN pip install --no-cache-dir -r requirements.txt
|
55 |
|
56 |
# Copy the rest of your application code
|
57 |
+
COPY --chown=user:user . .
|
58 |
|
59 |
+
# (Optional) Install Playwright browsers – this must be run after setting PLAYWRIGHT_BROWSERS_PATH
|
60 |
RUN python -m playwright install chromium
|
61 |
|
62 |
+
# Expose the port your application uses (e.g., 8501 for Streamlit)
|
63 |
EXPOSE 8501
|
64 |
|
65 |
+
# Set the default command to run your app
|
66 |
CMD ["python", "app.py"]
|