AbrahamKlb commited on
Commit
a259872
·
verified ·
1 Parent(s): cbe871d

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +41 -0
Dockerfile ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Stage 1: Build stage
2
+ FROM python:3.10-slim AS builder
3
+
4
+ # Set environment variables
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
+ # Set the working directory
9
+ WORKDIR /app
10
+
11
+
12
+ # Install the dependencies
13
+ COPY requirements.txt .
14
+ RUN pip install --no-cache-dir --upgrade pip
15
+ RUN pip install -U jax
16
+ RUN pip install -r requirements.txt
17
+
18
+ # Copy the rest of the application code
19
+ COPY app.py /app
20
+ COPY models/ /app/models
21
+
22
+ # Stage 2: Runtime stage
23
+ FROM python:3.10-slim
24
+
25
+ # Set environment variables
26
+ ENV PYTHONDONTWRITEBYTECODE=1
27
+ ENV PYTHONUNBUFFERED=1
28
+
29
+ # Set the working directory
30
+ WORKDIR /app
31
+
32
+ # Copy only the necessary files from the builder stage
33
+ COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
34
+ COPY --from=builder /usr/local/bin /usr/local/bin
35
+ COPY --from=builder /app /app
36
+
37
+ # Expose the port the app runs on
38
+ EXPOSE 8000
39
+
40
+ # Run the application
41
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]