Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -10
Dockerfile
CHANGED
|
@@ -1,16 +1,25 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
COPY requirements.txt .
|
| 7 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 8 |
|
| 9 |
-
# Copy
|
| 10 |
-
COPY .
|
| 11 |
|
| 12 |
-
# Expose
|
| 13 |
-
EXPOSE
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "
|
|
|
|
| 1 |
+
# Base image using Python 3.9
|
| 2 |
+
FROM python:3.9
|
| 3 |
|
| 4 |
+
# Create a new user to run the app
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
|
| 8 |
+
# Set environment variables
|
| 9 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 10 |
+
|
| 11 |
+
# Set the working directory
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
+
# Copy the requirements and install dependencies
|
| 15 |
+
COPY --chown=user ./requirements.txt requirements.txt
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 17 |
|
| 18 |
+
# Copy the rest of the application
|
| 19 |
+
COPY --chown=user . /app
|
| 20 |
|
| 21 |
+
# Expose port 7860 for the application
|
| 22 |
+
EXPOSE 7860
|
| 23 |
|
| 24 |
+
# Command to run the FastAPI app using uvicorn
|
| 25 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|