VaiVas commited on
Commit
03f4a3e
·
verified ·
1 Parent(s): a820e84

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +35 -21
Dockerfile CHANGED
@@ -1,21 +1,35 @@
1
- FROM python:3.10-slim
2
-
3
- WORKDIR /app
4
-
5
- RUN apt-get update && apt-get install -y \
6
- build-essential \
7
- git \
8
- && rm -rf /var/lib/apt/lists/*
9
-
10
-
11
- COPY requirements.txt .
12
-
13
- RUN pip install --no-cache-dir -r requirements.txt
14
-
15
- COPY . .
16
-
17
- RUN chmod +x inference.py
18
-
19
- ENV PYTHONUNBUFFERED=1
20
-
21
- ENTRYPOINT ["python3", "server/app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a lightweight Python base image
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ # git is often useful for MCP tools or cloning internal libraries
9
+ RUN apt-get update && apt-get install -y --no-install-recommended \
10
+ git \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy the configuration files first to leverage Docker cache
14
+ COPY pyproject.toml .
15
+ # Create a dummy README.md as it is referenced in pyproject.toml
16
+ RUN touch README.md
17
+
18
+ # Install the package and its dependencies
19
+ RUN pip install --no-cache-dir .
20
+
21
+ # Copy the source code into the container
22
+ COPY server/app.py .
23
+ COPY server/tasks.py .
24
+ COPY inference.py .
25
+
26
+ # Expose the port specified in your openenv.yaml
27
+ EXPOSE 7860
28
+
29
+ # Ensure logs are sent straight to terminal without buffering
30
+ ENV PYTHONUNBUFFERED=1
31
+ # Set the default port for the app
32
+ ENV PORT=7860
33
+
34
+ # Start the FastAPI server using the main entry point defined in app.py
35
+ CMD ["python", "server/app.py"]