Spaces:
Runtime error
Runtime error
Update Dockerfile (#3)
Browse files- Update Dockerfile (8e4dbd4530fe7dfa1a663a0fc2c8825afc6a03ca)
Co-authored-by: cyril sabu george <cyril-sabu@users.noreply.huggingface.co>
- Dockerfile +15 -12
Dockerfile
CHANGED
|
@@ -1,23 +1,26 @@
|
|
| 1 |
-
# Use an official
|
|
|
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy the file
|
|
|
|
| 8 |
COPY requirements.txt .
|
| 9 |
|
| 10 |
-
# Install
|
| 11 |
-
# --no-cache-dir
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
-
# Copy
|
| 15 |
-
#
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
#
|
| 19 |
EXPOSE 8080
|
| 20 |
|
| 21 |
-
# Define the command to run your
|
| 22 |
-
# This
|
| 23 |
-
CMD ["python", "app.py"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as a parent image
|
| 2 |
+
# Using a slim version to keep the image size smaller
|
| 3 |
FROM python:3.9-slim
|
| 4 |
|
| 5 |
+
# Set the working directory in the container
|
| 6 |
WORKDIR /app
|
| 7 |
|
| 8 |
+
# Copy the requirements file into the container at /app
|
| 9 |
+
# This is done first to leverage Docker's layer caching
|
| 10 |
COPY requirements.txt .
|
| 11 |
|
| 12 |
+
# Install any needed packages specified in requirements.txt
|
| 13 |
+
# Using --no-cache-dir to reduce image size
|
| 14 |
+
# Specifying a CPU-only version of PyTorch to significantly reduce image size
|
| 15 |
+
RUN pip install --no-cache-dir -r requirements.txt --index-url https://download.pytorch.org/whl/cpu
|
| 16 |
|
| 17 |
+
# Copy the rest of your application's code into the container
|
| 18 |
+
# This includes app.py, your trained model (.pth), and the scaler (.pkl)
|
| 19 |
COPY . .
|
| 20 |
|
| 21 |
+
# Make port 8080 available to the world outside this container
|
| 22 |
EXPOSE 8080
|
| 23 |
|
| 24 |
+
# Define the command to run your app
|
| 25 |
+
# This command runs when the container launches
|
| 26 |
+
CMD ["python", "app.py"]
|