dtrovato997 commited on
Commit
b1a7d86
·
1 Parent(s): a5a79d3
Files changed (1) hide show
  1. Dockerfile +19 -14
Dockerfile CHANGED
@@ -9,29 +9,34 @@ RUN apt-get update && apt-get install -y \
9
  curl \
10
  && rm -rf /var/lib/apt/lists/*
11
 
 
 
 
 
 
 
 
 
12
  RUN useradd -m -u 1000 user
 
 
13
  USER user
 
 
14
  ENV HOME=/home/user \
15
- PATH=/home/user/.local/bin:$PATH
16
-
17
- # Set working directory
18
- WORKDIR $HOME/app
19
 
20
- # Copy requirements and install Python dependencies
21
- COPY requirements.txt .
22
- RUN pip install --no-cache-dir -r requirements.txt
23
 
24
- # Copy application code
25
  COPY --chown=user . $HOME/app
26
 
27
- # Create directories
28
- RUN mkdir -p uploads cache
29
 
30
  # Expose port 7860 (HF Spaces default)
31
  EXPOSE 7860
32
 
33
- # Set environment variable for HF Spaces
34
- ENV PORT=7860
35
-
36
  # Start the FastAPI app with uvicorn
37
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
9
  curl \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Set working directory
13
+ WORKDIR /code
14
+
15
+ # Copy requirements and install Python dependencies
16
+ COPY ./requirements.txt /code/requirements.txt
17
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
18
+
19
+ # Create user with proper permissions for HF Spaces
20
  RUN useradd -m -u 1000 user
21
+
22
+ # Switch to user
23
  USER user
24
+
25
+ # Set environment variables
26
  ENV HOME=/home/user \
27
+ PATH=/home/user/.local/bin:$PATH
 
 
 
28
 
29
+ # Set user's working directory
30
+ WORKDIR $HOME/app
 
31
 
32
+ # Copy application code with proper ownership
33
  COPY --chown=user . $HOME/app
34
 
35
+ # Create directories with proper permissions
36
+ RUN mkdir -p $HOME/app/uploads $HOME/app/cache
37
 
38
  # Expose port 7860 (HF Spaces default)
39
  EXPOSE 7860
40
 
 
 
 
41
  # Start the FastAPI app with uvicorn
42
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]