Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +9 -13
Dockerfile
CHANGED
|
@@ -1,17 +1,8 @@
|
|
| 1 |
# Base image using Python 3.9
|
| 2 |
FROM python:3.9
|
| 3 |
|
| 4 |
-
# Install system dependencies
|
| 5 |
-
USER root
|
| 6 |
-
RUN apt-get update \
|
| 7 |
-
&& apt-get install -y --no-install-recommends \
|
| 8 |
-
poppler-utils \
|
| 9 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
-
|
| 11 |
# Create a new user to run the app
|
| 12 |
RUN useradd -m -u 1000 user
|
| 13 |
-
|
| 14 |
-
# Switch to non-root user
|
| 15 |
USER user
|
| 16 |
|
| 17 |
# Set environment variables
|
|
@@ -20,15 +11,20 @@ ENV PATH="/home/user/.local/bin:$PATH"
|
|
| 20 |
# Set the working directory
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
-
# Copy the requirements and install
|
| 24 |
-
COPY --chown=user
|
| 25 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
# Copy the rest of the application
|
| 28 |
-
COPY --chown=user
|
| 29 |
|
| 30 |
# Expose port 7860 for the application
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
# Command to run the FastAPI app using uvicorn
|
| 34 |
-
CMD ["uvicorn", "
|
|
|
|
| 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
|
|
|
|
| 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 |
+
RUN apt-get update \
|
| 19 |
+
&& apt-get install -y --no-install-recommends \
|
| 20 |
+
poppler-utils \
|
| 21 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
+
|
| 23 |
# Copy the rest of the application
|
| 24 |
+
COPY --chown=user . /app
|
| 25 |
|
| 26 |
# Expose port 7860 for the application
|
| 27 |
EXPOSE 7860
|
| 28 |
|
| 29 |
# Command to run the FastAPI app using uvicorn
|
| 30 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|