Spaces:
Sleeping
Sleeping
Create dockerfile
Browse files- dockerfile +57 -0
dockerfile
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.11 as the base image
|
| 2 |
+
FROM docker.io/library/python:3.11@sha256:YOUR_PYTHON_3_11_SHA # Replace with the correct SHA for Python 3.11
|
| 3 |
+
|
| 4 |
+
# Install system dependencies
|
| 5 |
+
RUN apt-get update && apt-get install -y \
|
| 6 |
+
git \
|
| 7 |
+
git-lfs \
|
| 8 |
+
ffmpeg \
|
| 9 |
+
libsm6 \
|
| 10 |
+
libxext6 \
|
| 11 |
+
cmake \
|
| 12 |
+
rsync \
|
| 13 |
+
libgl1-mesa-glx \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/* \
|
| 15 |
+
&& git lfs install
|
| 16 |
+
|
| 17 |
+
# Upgrade pip and install Hugging Face specific dependencies
|
| 18 |
+
RUN pip install --no-cache-dir pip -U && \
|
| 19 |
+
pip install --no-cache-dir \
|
| 20 |
+
datasets \
|
| 21 |
+
"huggingface-hub>=0.19" \
|
| 22 |
+
"hf_xet>=1.0.0,<2.0.0" \
|
| 23 |
+
"hf-transfer>=0.1.4" \
|
| 24 |
+
"protobuf<4" \
|
| 25 |
+
"click<8.1" \
|
| 26 |
+
"pydantic~=1.0"
|
| 27 |
+
|
| 28 |
+
# Install fakeroot for apt-get compatibility
|
| 29 |
+
RUN apt-get update && apt-get install -y fakeroot && \
|
| 30 |
+
mv /usr/bin/apt-get /usr/bin/.apt-get && \
|
| 31 |
+
echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \
|
| 32 |
+
chmod +x /usr/bin/apt-get && \
|
| 33 |
+
rm -rf /var/lib/apt/lists/* && \
|
| 34 |
+
useradd -m -u 1000 user
|
| 35 |
+
|
| 36 |
+
# Copy root files (if needed)
|
| 37 |
+
COPY --chown=1000:1000 --from=root / /
|
| 38 |
+
|
| 39 |
+
# Set working directory
|
| 40 |
+
WORKDIR /home/user/app
|
| 41 |
+
|
| 42 |
+
# Install Node.js
|
| 43 |
+
RUN apt-get update && \
|
| 44 |
+
apt-get install -y curl && \
|
| 45 |
+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 46 |
+
apt-get install -y nodejs && \
|
| 47 |
+
rm -rf /var/lib/apt/lists/* && apt-get clean
|
| 48 |
+
|
| 49 |
+
# Copy requirements.txt and install Python dependencies
|
| 50 |
+
COPY --chown=1000:1000 requirements.txt /tmp/requirements.txt
|
| 51 |
+
RUN pip install --no-cache-dir -r /tmp/requirements.txt
|
| 52 |
+
|
| 53 |
+
# Copy application code (adjust as per your repo structure)
|
| 54 |
+
COPY --chown=1000:1000 . .
|
| 55 |
+
|
| 56 |
+
# Command to run the app
|
| 57 |
+
CMD ["python", "app.py"]
|