Create Dockerfile
Browse files- Dockerfile +21 -0
Dockerfile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use official Python image
|
| 2 |
+
FROM python:3.9
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /code
|
| 6 |
+
|
| 7 |
+
# Copy requirements and install dependencies
|
| 8 |
+
# Note: We use the CPU version of PyTorch to keep the image small
|
| 9 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 10 |
+
RUN pip install --no-cache-dir --upgrade pip
|
| 11 |
+
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
| 12 |
+
RUN pip install --no-cache-dir -r /code/requirements.txt
|
| 13 |
+
|
| 14 |
+
# Copy the rest of the files
|
| 15 |
+
COPY . .
|
| 16 |
+
|
| 17 |
+
# Grant permissions (sometimes needed for HF)
|
| 18 |
+
RUN chmod -R 777 /code
|
| 19 |
+
|
| 20 |
+
# Run the app
|
| 21 |
+
CMD ["python", "app.py"]
|