FASTAPI / Dockerfile
tejani's picture
Update Dockerfile
f484a01 verified
# Use an official Python runtime as the base image
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Install system dependencies for git, OpenCV, OpenVINO, and other requirements
RUN apt-get update && apt-get install -y \
git \
build-essential \
libpq-dev \
libgl1 \
libopencv-dev \
libblas-dev \
liblapack-dev \
&& rm -rf /var/lib/apt/lists/*
# Clone the repository
RUN git clone https://github.com/rupeshs/fastsdcpu.git .
# Create a virtual environment
RUN python -m venv env
# Set environment variables for Hugging Face cache and OpenVINO telemetry
ENV HF_HOME=/app/.cache/huggingface \
OPENVINO_TELEMETRY_DIR=/app/telemetry
# Create cache, telemetry, configs, and results directories with write permissions
RUN mkdir -p /app/.cache/huggingface /app/telemetry /app/configs /app/results && \
chmod -R 777 /app/.cache /app/telemetry /app/configs /app/results
# Activate virtual environment and install Python dependencies
RUN . env/bin/activate && pip install --no-cache-dir -r requirements.txt
# Ensure the start-webserver.sh script is executable
RUN chmod +x start-webserver.sh
# Expose port (default to 8000, adjust if the script specifies another port)
#EXPOSE 8000
# Run the start-webserver.sh script
CMD ["./start-webserver.sh"]