pvanand commited on
Commit
0b8d8bf
·
verified ·
1 Parent(s): b787d17

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -3
Dockerfile CHANGED
@@ -33,7 +33,10 @@ ENV PATH="/root/.cargo/bin:${PATH}"
33
  # Create a virtual environment using uv
34
  RUN uv venv
35
 
36
- # Use uv instead of pip for installing packages
 
 
 
37
  RUN uv pip install --no-cache-dir -r requirements.txt
38
 
39
  # Create a non-root user
@@ -45,5 +48,11 @@ RUN chown -R myuser:myuser /app
45
  # Switch to the non-root user
46
  USER myuser
47
 
48
- # Start the FastAPI app on port 7860, the default port expected by Spaces
49
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
33
  # Create a virtual environment using uv
34
  RUN uv venv
35
 
36
+ # Activate the virtual environment
37
+ ENV PATH="/app/.venv/bin:$PATH"
38
+
39
+ # Install packages using uv
40
  RUN uv pip install --no-cache-dir -r requirements.txt
41
 
42
  # Create a non-root user
 
48
  # Switch to the non-root user
49
  USER myuser
50
 
51
+ # Create a startup script
52
+ RUN echo '#!/bin/bash' > /app/start.sh && \
53
+ echo 'source /app/.venv/bin/activate' >> /app/start.sh && \
54
+ echo 'exec uvicorn main:app --host 0.0.0.0 --port 7860' >> /app/start.sh && \
55
+ chmod +x /app/start.sh
56
+
57
+ # Use the startup script to run the application
58
+ CMD ["/app/start.sh"]