File size: 1,191 Bytes
d5a3a91
 
 
 
 
b3f1ae8
 
 
 
 
 
d5a3a91
 
 
 
b3f1ae8
 
 
d5a3a91
 
b3f1ae8
dae72be
8c845b3
dae72be
 
 
d5a3a91
dae72be
f54c96f
0751399
f54c96f
 
4c2a0c7
 
d5a3a91
4c2a0c7
 
 
 
 
 
 
 
f54c96f
 
d5a3a91
dae72be
d5a3a91
 
dae72be
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM python:3.9-slim

WORKDIR /code

# Install system dependencies
# RUN apt-get update && apt-get install -y \
#     build-essential \
#     git \
#     curl \
#     && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y \
    build-essential \
    git \
    curl \
    cmake \
    ninja-build \
    libopenblas-dev \
    && rm -rf /var/lib/apt/lists/*


# Copy requirements first to leverage Docker cache
COPY app/requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the application code (excluding models)
COPY app /code/app
COPY app/main.py ./main.py

# Create models and cache directories and set correct permissions
# RUN mkdir -p /code/models/.cache/huggingface && \
#     chown -R appuser:appuser /code/models

# # Set environment variables
# ENV HOST=0.0.0.0
# ENV PORT=7860

# Create models and huggingface cache directories
RUN mkdir -p /code/models/.cache/huggingface

# Set environment variables properly
ENV HOST=0.0.0.0
ENV PORT=7860

# Expose the port that FastAPI will run on
EXPOSE 7860

# Command to run the FastAPI application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]