Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -30
Dockerfile
CHANGED
|
@@ -1,38 +1,21 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
|
| 5 |
-
# Install ffmpeg
|
| 6 |
-
# RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
|
| 7 |
-
|
| 8 |
-
# Create a non-root user with
|
| 9 |
-
RUN useradd -m -u 2000 user
|
| 10 |
-
USER user
|
| 11 |
-
ENV PATH="/home/user/.local/bin:$PATH"
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
# Set working directory
|
| 15 |
WORKDIR /app
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
COPY
|
| 19 |
-
RUN
|
| 20 |
|
|
|
|
|
|
|
| 21 |
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
#COPY --chown=user package*.json ./
|
| 25 |
-
# RUN npm install
|
| 26 |
-
|
| 27 |
-
# Copy the rest of the application source
|
| 28 |
-
COPY --chown=user . /app
|
| 29 |
-
|
| 30 |
-
# Expose the port if needed (optional, depending on the hosting environment)
|
| 31 |
EXPOSE 7860
|
| 32 |
-
EXPOSE 8000
|
| 33 |
-
EXPOSE 8080
|
| 34 |
-
|
| 35 |
-
# Run the Node.js application
|
| 36 |
-
# CMD ["node", "app.js"]
|
| 37 |
|
| 38 |
-
|
|
|
|
|
|
| 1 |
+
# Use the official lightweight Python image
|
| 2 |
+
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set the working directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy dependencies and install them
|
| 8 |
+
COPY requirements.txt .
|
| 9 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
|
| 11 |
+
# Copy the rest of the application code
|
| 12 |
+
COPY . .
|
| 13 |
|
| 14 |
+
# Create a directory for static files (frontend) if it doesn't exist
|
| 15 |
+
RUN mkdir -p static
|
| 16 |
|
| 17 |
+
# Expose the port Hugging Face expects
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
EXPOSE 7860
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
# Run the FastAPI server
|
| 21 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|