rajkhanke commited on
Commit
c429f41
·
verified ·
1 Parent(s): ccfb2e8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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 security
5
  RUN adduser --disabled-password --gecos "" appuser
6
 
7
- # Set the working directory in the container
8
  WORKDIR /app
9
 
10
- # Copy the requirements file to the container
11
- COPY requirements.txt /app/
12
-
13
- # Install the dependencies
14
- RUN pip install --no-cache-dir -r requirements.txt
15
 
16
  # Copy the application code to the container
17
- COPY . /app/
 
 
 
18
 
19
- # Create directories for uploads and logs and grant appuser ownership
20
- RUN mkdir -p /app/uploads /app/logs && \
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 ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
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"]