Spaces:
Running
Running
File size: 923 Bytes
857c85b 6307f85 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
FROM python:3.8-slim
# Install Dependencies
RUN apt-get update -q \
&& apt-get install -qy --no-install-recommends wget git libopencv-dev python3-opencv \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set up a non-root user
RUN useradd -m -u 1000 user \
&& mkdir /app \
&& chown -R user /app
# Switch to the "user" user
USER user
# Set the working directory to the user's home directory
WORKDIR /app
ENV PYTHONUNBUFFERED=True \
VITH_CHECKPOINT=/app/models/sam_vit_h_4b8939.pth \
MOBILESAM_CHECKPOINT=/app/models/mobile_sam.pt \
ONNX_CHECKPOINT=/app/models/sam_onnx_quantized_example.onnx \
PORT=7860
# Copy and run the model download script
COPY download_models.sh .
RUN bash /app/download_models.sh
# Install Python dependencies
COPY requirements.txt .
RUN pip install --user --no-cache-dir -r requirements.txt
COPY . ./
EXPOSE 7860
CMD ["/app/start.sh"]
|