Spaces:
Sleeping
Sleeping
Commit
·
63d21a4
1
Parent(s):
382badb
added new docker file
Browse files- DockerFile +25 -0
DockerFile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use Python 3.9 as the base image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
+
|
| 4 |
+
# Create a user to avoid running as root
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
USER user
|
| 7 |
+
|
| 8 |
+
# Set the PATH environment variable
|
| 9 |
+
ENV PATH="/home/user/.local/bin:$PATH"
|
| 10 |
+
|
| 11 |
+
# Set the working directory inside the container
|
| 12 |
+
WORKDIR /app
|
| 13 |
+
|
| 14 |
+
# Copy and install dependencies first (this speeds up builds)
|
| 15 |
+
COPY --chown=user requirements.txt .
|
| 16 |
+
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 17 |
+
|
| 18 |
+
# Copy the entire project after installing dependencies
|
| 19 |
+
COPY --chown=user . .
|
| 20 |
+
|
| 21 |
+
# Expose the port for Uvicorn
|
| 22 |
+
EXPOSE 7860
|
| 23 |
+
|
| 24 |
+
# Run the application using Uvicorn
|
| 25 |
+
CMD ["uvicorn", "api.app:app", "--host", "0.0.0.0", "--port", "7860"]
|