samvish commited on
Commit
850cabf
·
verified ·
1 Parent(s): 984961b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -22
Dockerfile CHANGED
@@ -1,27 +1,35 @@
1
- FROM python:3.10-slim
2
 
3
- WORKDIR /app
 
4
 
5
- COPY requirements.txt .
6
- RUN pip install --no-cache-dir -r requirements.txt
7
-
8
- COPY app/ ./app/
9
-
10
- ENV PYTHONPATH=/app
11
 
12
- # Create writable cache directory for Composio
13
- RUN mkdir -p /app/.composio && chmod 777 /app/.composio
14
- ENV COMPOSIO_CACHE_DIR=/app/.composio
 
15
 
16
- # Create writable lock directory for Composio
17
- RUN mkdir -p /app/.composio/locks && chmod 777 /app/.composio/locks
18
- ENV COMPOSIO_LOCK_DIR=/app/.composio/locks
19
-
20
- # Debug: Print environment variables
21
- RUN echo "GOOGLE_API_KEY is: $GOOGLE_API_KEY" > /app/env_debug.txt
22
- RUN echo "COMPOSIO_API_KEY is: $COMPOSIO_API_KEY" >> /app/env_debug.txt
23
-
24
- # Enable Composio debug logging
25
- ENV COMPOSIO_LOGGING_LEVEL=debug
26
 
27
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile
2
 
3
+ # Use an official Python runtime as a parent image
4
+ FROM python:3.11-slim
5
 
6
+ # Set the working directory in the container
7
+ WORKDIR /code
 
 
 
 
8
 
9
+ # Prevent Python from writing pyc files to disc
10
+ ENV PYTHONDONTWRITEBYTECODE 1
11
+ # Ensure Python output is sent straight to terminal without buffering
12
+ ENV PYTHONUNBUFFERED 1
13
 
14
+ # Copy the requirements file into the container at /code
15
+ COPY requirements.txt .
 
 
 
 
 
 
 
 
16
 
17
+ # Install any needed packages specified in requirements.txt
18
+ # --no-cache-dir reduces image size
19
+ # --upgrade ensures pip is the latest
20
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt
21
+
22
+ # Copy the rest of the application code into the container at /code
23
+ COPY . /code
24
+
25
+ # Expose the port the app runs on
26
+ # Hugging Face Spaces typically uses 7860, but uvicorn defaults to 8000.
27
+ # Let's align with the common uvicorn default unless HF forces 7860.
28
+ # If using HF SDK set to FastAPI, it might expect 7860. If using Docker directly, 8000 is fine.
29
+ # Let's use 7860 for better compatibility with HF typical setups.
30
+ EXPOSE 7860
31
+
32
+ # Define the command to run the application
33
+ # Runs the Uvicorn server, listening on all interfaces (0.0.0.0)
34
+ # app:app means "in the file app.py, find the FastAPI instance named app"
35
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]