nanee-animation / Dockerfile
ygauravyy's picture
Update Dockerfile
03675f9 verified
raw
history blame
2.28 kB
# syntax = docker/dockerfile:1.2
FROM python:3.8
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
WORKDIR /home/user
ENV PATH="/home/user/.local/bin:$PATH"
# Install system packages needed for OpenCV and other dependencies
USER root
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \
curl \
vim \
sudo \
default-jre \
git \
gcc \
build-essential \
libgl1-mesa-glx \
libglib2.0-0 \
netcat-openbsd \
&& rm -rf /var/lib/apt/lists/*
USER user
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
RUN pip install --no-cache-dir openmim
RUN pip install --no-cache-dir torch==2.0.0
RUN mim install mmcv-full==1.7.0
RUN pip install --no-cache-dir mmdet==2.27.0
RUN pip install --no-cache-dir torchserve
# Clone and install xtcocoapi (a dependency for mmpose)
RUN git clone https://github.com/jin-s13/xtcocoapi.git
WORKDIR xtcocoapi
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install -e .
WORKDIR /home/user
# Install additional Python packages
RUN pip install --no-cache-dir mmpose==0.29.0
RUN pip install --no-cache-dir torchvision==0.15.1 numpy==1.24.4
# Copy your application code
COPY --chown=user . .
# Install your application's Python dependencies
RUN pip install --no-cache-dir -e .
# Prepare TorchServe model-store and download necessary models
RUN mkdir -p /home/user/torchserve/model-store
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_detector.mar -P /home/user/torchserve/model-store/
RUN wget https://github.com/facebookresearch/AnimatedDrawings/releases/download/v0.0.1/drawn_humanoid_pose_estimator.mar -P /home/user/torchserve/model-store/
# Copy TorchServe configuration files
COPY config.properties /home/user/torchserve/config.properties
# COPY config.local.properties /home/user/torchserve/config.local.properties # Ensure this file exists
# Copy the start.sh script and set executable permissions
COPY --chmod=0755 start.sh /home/user/start.sh
# Expose necessary ports
EXPOSE 7860 8080 8081 8082
# Start both TorchServe and Gradio
CMD ["/home/user/start.sh"]