pvanand commited on
Commit
0de35ca
·
verified ·
1 Parent(s): 4c749ed

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -10
Dockerfile CHANGED
@@ -4,25 +4,34 @@ FROM python:3.10.9
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
- COPY requirements.txt /app
 
8
 
9
- # Install any needed packages specified in requirements.txt
 
 
 
10
  RUN pip install --no-cache-dir -r requirements.txt
11
 
12
  # Create a non-root user
13
  RUN useradd -m appuser
14
 
15
- # Create necessary directories and set permissions
16
- RUN mkdir -p /app/data /app/indexes /tmp/app-work && \
17
- chown -R appuser:appuser /app /tmp/app-work && \
18
  chmod -R 755 /app && \
19
- chmod -R 777 /tmp/app-work
 
 
 
 
 
 
20
 
21
- # Switch to the non-root user
22
  USER appuser
23
 
24
- # Copy the current directory contents into the container at /app
25
- COPY . /app
26
 
27
- # Start the FastAPI app on port 7860, the default port expected by Spaces
28
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
+ # Create necessary directories
8
+ RUN mkdir -p /app/sites /app/temp
9
 
10
+ # Copy requirements first for better caching
11
+ COPY requirements.txt /app/
12
+
13
+ # Requirements for the static site server
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
  # Create a non-root user
17
  RUN useradd -m appuser
18
 
19
+ # Set up proper permissions
20
+ RUN chown -R appuser:appuser /app && \
 
21
  chmod -R 755 /app && \
22
+ chmod -R 777 /app/sites /app/temp
23
+
24
+ # Copy the application code
25
+ COPY . /app/
26
+
27
+ # Set proper ownership for copied files
28
+ RUN chown -R appuser:appuser /app
29
 
30
+ # Switch to non-root user
31
  USER appuser
32
 
33
+ # Expose the port
34
+ EXPOSE 7860
35
 
36
+ # Command to run the application
37
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]