Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -15
Dockerfile
CHANGED
|
@@ -1,30 +1,28 @@
|
|
| 1 |
# Use an official Python runtime as the base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Create a non-root user for
|
| 5 |
RUN adduser --disabled-password --gecos "" appuser
|
| 6 |
|
| 7 |
-
# Set the working directory
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
-
# Copy the requirements file
|
| 11 |
-
COPY requirements.txt
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
# Copy the application code to the container
|
| 17 |
-
COPY .
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
chown -R appuser:appuser /app/uploads /app/logs
|
| 22 |
|
| 23 |
# Switch to the non-root user
|
| 24 |
USER appuser
|
| 25 |
|
| 26 |
-
# Expose the port your app runs on
|
| 27 |
-
EXPOSE 7860
|
| 28 |
-
|
| 29 |
# Command to run the application
|
| 30 |
-
CMD ["
|
|
|
|
| 1 |
# Use an official Python runtime as the base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Create a non-root user for running the app
|
| 5 |
RUN adduser --disabled-password --gecos "" appuser
|
| 6 |
|
| 7 |
+
# Set the working directory
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
+
# Copy the requirements file and install dependencies
|
| 11 |
+
COPY requirements.txt .
|
| 12 |
+
RUN pip install --upgrade pip && \
|
| 13 |
+
pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 14 |
|
| 15 |
# Copy the application code to the container
|
| 16 |
+
COPY . .
|
| 17 |
+
|
| 18 |
+
# Create uploads and logs folders, and adjust permissions
|
| 19 |
+
RUN mkdir -p uploads logs && chown -R appuser:appuser uploads logs
|
| 20 |
|
| 21 |
+
# Expose the port your app listens on (Hugging Face Spaces expects port 7860)
|
| 22 |
+
EXPOSE 7860
|
|
|
|
| 23 |
|
| 24 |
# Switch to the non-root user
|
| 25 |
USER appuser
|
| 26 |
|
|
|
|
|
|
|
|
|
|
| 27 |
# Command to run the application
|
| 28 |
+
CMD ["python", "app.py"]
|