File size: 1,081 Bytes
6b76e14
b91b7e7
d52fc1f
6a24f7c
b91b7e7
 
6a24f7c
b91b7e7
 
6a24f7c
b91b7e7
 
6a24f7c
 
b91b7e7
6a24f7c
b91b7e7
6a24f7c
 
b91b7e7
 
 
 
6a24f7c
b91b7e7
 
6a24f7c
74f8372
b91b7e7
6a24f7c
74f8372
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
FROM tiangolo/uvicorn-gunicorn:python3.11-slim


# Set the working directory to /app
WORKDIR /app

# Copy the requirements file to install dependencies
COPY requirements.txt .

# Install necessary dependencies (FastAPI, ONNX Runtime, etc.)
RUN pip install --no-cache-dir -r requirements.txt

# Ensure wget and required dependencies are available
RUN apt-get update && apt-get install -y wget && apt-get clean

# Download the ONNX model file and save it in the desired path
RUN mkdir -p /app/services/onnx_clip/data && \
    wget -O /app/services/onnx_clip/data/clip_image_model_vitb32.onnx \
    "https://storage.cloud.google.com/embedding_model_1/clip_image_model_vitb32.onnx"

# Copy the FastAPI app code into the container
COPY . .

# Set the model path as an environment variable (for reference in your code)
ENV MODEL_PATH="/app/services/onnx_clip/data/clip_image_model_vitb32.onnx"

# Expose port 8000 to access the FastAPI app
EXPOSE 7860

# Run the FastAPI app using Uvicorn
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]