Spaces:
Paused
Paused
Gaurav Yadav
commited on
Update Dockerfile
Browse files- Dockerfile +13 -63
Dockerfile
CHANGED
|
@@ -1,71 +1,21 @@
|
|
| 1 |
-
# syntax
|
| 2 |
|
| 3 |
-
FROM
|
| 4 |
|
| 5 |
-
# Create a non-root user
|
| 6 |
-
RUN useradd -m -u 1000 user
|
| 7 |
-
USER user
|
| 8 |
-
WORKDIR /home/user
|
| 9 |
-
|
| 10 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 11 |
-
|
| 12 |
-
# Install system packages needed for OpenCV and other dependencies
|
| 13 |
USER root
|
| 14 |
-
|
| 15 |
-
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
| 16 |
-
ca-certificates \
|
| 17 |
-
curl \
|
| 18 |
-
vim \
|
| 19 |
-
sudo \
|
| 20 |
-
default-jre \
|
| 21 |
-
git \
|
| 22 |
-
gcc \
|
| 23 |
-
build-essential \
|
| 24 |
-
libgl1-mesa-glx \
|
| 25 |
-
libglib2.0-0 \
|
| 26 |
-
netcat-openbsd \
|
| 27 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 28 |
-
USER user
|
| 29 |
-
|
| 30 |
-
# Install Python dependencies
|
| 31 |
-
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 32 |
-
RUN pip install --no-cache-dir openmim
|
| 33 |
-
RUN pip install --no-cache-dir torch==2.0.0
|
| 34 |
-
RUN mim install mmcv-full==1.7.0
|
| 35 |
-
RUN pip install --no-cache-dir mmdet==2.27.0
|
| 36 |
-
RUN pip install --no-cache-dir torchserve
|
| 37 |
-
|
| 38 |
-
# Clone and install xtcocoapi (a dependency for mmpose)
|
| 39 |
-
RUN git clone https://github.com/jin-s13/xtcocoapi.git
|
| 40 |
-
WORKDIR xtcocoapi
|
| 41 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 42 |
-
RUN pip install -e .
|
| 43 |
-
WORKDIR /home/user
|
| 44 |
|
| 45 |
-
#
|
| 46 |
-
|
| 47 |
-
RUN pip install --no-cache-dir torchvision==0.15.1 numpy==1.24.4
|
| 48 |
|
| 49 |
-
#
|
| 50 |
-
|
| 51 |
|
| 52 |
-
# Install your
|
| 53 |
-
RUN pip install
|
| 54 |
-
|
| 55 |
-
# Prepare TorchServe model-store and download necessary models
|
| 56 |
-
RUN mkdir -p /home/user/torchserve/model-store
|
| 57 |
-
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/user/torchserve/model-store/
|
| 58 |
-
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/user/torchserve/model-store/
|
| 59 |
-
|
| 60 |
-
# Copy TorchServe configuration files
|
| 61 |
-
COPY config.properties /home/user/torchserve/config.properties
|
| 62 |
-
# COPY config.local.properties /home/user/torchserve/config.local.properties # Ensure this file exists
|
| 63 |
-
|
| 64 |
-
# Copy the start.sh script and set executable permissions
|
| 65 |
-
COPY --chmod=0755 start.sh /home/user/start.sh
|
| 66 |
|
| 67 |
-
# Expose
|
| 68 |
-
EXPOSE 7860
|
| 69 |
|
| 70 |
-
#
|
| 71 |
-
CMD ["
|
|
|
|
| 1 |
+
# syntax=docker/dockerfile:1.2
|
| 2 |
|
| 3 |
+
FROM continuumio/miniconda3:24.1.2-0
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
USER root
|
| 6 |
+
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# Copy all repository files into the image
|
| 9 |
+
COPY . /app
|
|
|
|
| 10 |
|
| 11 |
+
# Run the torchserve setup script that replicates the steps from the original torchserve Dockerfile
|
| 12 |
+
RUN chmod +x /app/torchserve_setup.sh && /app/torchserve_setup.sh
|
| 13 |
|
| 14 |
+
# Install your package in editable mode
|
| 15 |
+
RUN pip install -e .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# Expose port 7860 for Gradio on Hugging Face Spaces
|
| 18 |
+
EXPOSE 7860
|
| 19 |
|
| 20 |
+
# Run the Gradio app
|
| 21 |
+
CMD ["python", "app.py"]
|