Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +18 -16
Dockerfile
CHANGED
@@ -15,27 +15,29 @@
|
|
15 |
# COPY --chown=user . /app
|
16 |
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
17 |
|
18 |
-
|
|
|
19 |
|
20 |
-
#
|
21 |
-
|
22 |
-
|
23 |
-
# Switch to the created user
|
24 |
-
USER user
|
25 |
-
|
26 |
-
# Set PATH to include the user-specific bin directory
|
27 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
28 |
|
29 |
# Set the working directory
|
30 |
WORKDIR /app
|
31 |
|
32 |
-
#
|
33 |
-
COPY
|
34 |
-
RUN pip install --no-cache-dir
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
#
|
37 |
-
|
38 |
|
39 |
-
# Command to run the
|
40 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "
|
41 |
|
|
|
15 |
# COPY --chown=user . /app
|
16 |
# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
17 |
|
18 |
+
# Use a base image with Python and necessary dependencies
|
19 |
+
FROM python:3.10-slim
|
20 |
|
21 |
+
# Set environment variables
|
22 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
23 |
+
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
# Set the working directory
|
26 |
WORKDIR /app
|
27 |
|
28 |
+
# Install necessary packages
|
29 |
+
COPY requirements.txt .
|
30 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
31 |
+
|
32 |
+
# Copy the application code and model download script
|
33 |
+
COPY . .
|
34 |
+
|
35 |
+
# Run the model download script
|
36 |
+
RUN python download_model.py
|
37 |
|
38 |
+
# Expose the port the app runs on
|
39 |
+
EXPOSE 8000
|
40 |
|
41 |
+
# Command to run the FastAPI app
|
42 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|
43 |
|