Nechba commited on
Commit
808e59f
1 Parent(s): e9f5b88

first commit

Browse files
Files changed (1) hide show
  1. dockerfile +39 -0
dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # Use a multi-stage build to reduce final image size
3
+ # Start with a builder image
4
+ FROM python:3.10-slim as builder
5
+
6
+ # Set a working directory
7
+ WORKDIR /app
8
+
9
+ # Install dependencies in a virtual environment to make it easier to copy only what we need later
10
+ RUN python -m venv /venv
11
+ ENV PATH="/venv/bin:$PATH"
12
+
13
+ # Copy only requirements.txt initially to leverage Docker cache
14
+ COPY requirements.txt .
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
+
17
+ # Continue with the final base image
18
+ FROM tiangolo/uvicorn-gunicorn-fastapi:python3.10-slim
19
+
20
+ # Install curl
21
+ RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
22
+
23
+
24
+
25
+ # Copy the virtual environment from the builder stage
26
+ COPY --from=builder /venv /venv
27
+ ENV PATH="/venv/bin:$PATH"
28
+
29
+ # Set working directory
30
+ WORKDIR /app
31
+
32
+ # Copy the rest of the application from the current directory to /app inside the container
33
+ COPY . .
34
+
35
+ # Expose port 80 to the outside world
36
+ EXPOSE 80
37
+
38
+ # Command to run the Uvicorn server using check_health.sh to wait for the model_server
39
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80","--log-level","debug"]