AhsanAftab's picture
Create Dockerfile
dc0fafa verified
raw
history blame contribute delete
590 Bytes
# Use official Python image
FROM python:3.9
# Set working directory
WORKDIR /code
# Copy requirements and install dependencies
# Note: We use the CPU version of PyTorch to keep the image small
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
RUN pip install --no-cache-dir -r /code/requirements.txt
# Copy the rest of the files
COPY . .
# Grant permissions (sometimes needed for HF)
RUN chmod -R 777 /code
# Run the app
CMD ["python", "app.py"]