# Use a Debian-based Python image | |
FROM python:3.8-slim | |
# Update packages and install the necessary system dependencies | |
RUN apt-get update && apt-get install -y \ | |
git \ | |
gcc \ | |
libhdf5-dev \ | |
pkg-config \ | |
g++ \ | |
libgl1-mesa-glx \ | |
libglib2.0-0 \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Install PyTorch and torchvision (or other packages as needed) | |
RUN pip install torch torchvision | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy your application code to the container | |
COPY app/ . | |
COPY ./requirements.txt /app/requirements.txt | |
# Install Python dependencies from requirements.txt | |
RUN pip install -r requirements.txt | |
# Define the command to run your app using CMD which should be overridden when using the container with different commands | |
CMD ["gunicorn", "-b", "0.0.0.0:7860" ,"app:app"] | |