File size: 943 Bytes
1bd93b7
230f597
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1bd93b7
230f597
1bd93b7
230f597
 
 
 
311caf1
230f597
1be45c0
 
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
# Use a lightweight and stable Python 3.11 base image (Bullseye)
FROM python:3.11-slim-bullseye AS base

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PATH="/home/user/.local/bin:$PATH"

RUN apt-get update && apt-get install -y \
    openssl \
    ca-certificates \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -m -u 1000 user
USER user
WORKDIR /app

COPY --chown=user ./requirements.txt requirements.txt
COPY --chown=user ./app/insightfy_utils-0.1.0-py3-none-any.whl insightfy_utils-0.1.0-py3-none-any.whl
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir insightfy_utils-0.1.0-py3-none-any.whl && \
    pip install --no-cache-dir --upgrade -r requirements.txt

COPY --chown=user . /app

EXPOSE 7860

# Optimize: Use single worker for faster startup, add timeout
CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860} --workers 1 --timeout-keep-alive 30 --log-level info"]