Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +27 -0
Dockerfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
FROM python:3.8-slim
|
| 3 |
+
|
| 4 |
+
# Set the working directory in the container
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Copy only the files needed for pip install first to leverage Docker caching
|
| 8 |
+
COPY requirements.txt ./
|
| 9 |
+
|
| 10 |
+
# Install any needed packages specified in requirements.txt
|
| 11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
+
|
| 13 |
+
# Install PyTorch
|
| 14 |
+
RUN pip install torch torchvision torchaudio -f https://download.pytorch.org/whl/torch_stable.html
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# Copy the rest of your application's source code from your host to your image filesystem
|
| 18 |
+
COPY . /app
|
| 19 |
+
|
| 20 |
+
# Make port 8000 available to the world outside this container
|
| 21 |
+
EXPOSE 8000
|
| 22 |
+
|
| 23 |
+
# Define environment variable
|
| 24 |
+
ENV NAME World
|
| 25 |
+
|
| 26 |
+
# Command to run the application
|
| 27 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|