File size: 682 Bytes
8a4fc79
ead3bd5
8a4fc79
 
 
 
 
 
 
 
ead3bd5
 
 
 
 
 
8a4fc79
3d296eb
8a4fc79
 
ead3bd5
8a4fc79
3d296eb
 
 
 
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
FROM python:3.12-slim

# Installa distutils (e setuptools se vuoi)
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        python3-distutils \
        python3-setuptools \
    && rm -rf /var/lib/apt/lists/*

# Crea utente non privilegiato
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

WORKDIR /app

# Copia il file requirements.txt e installa i pacchetti
COPY --chown=user: ./requirements.txt requirements.txt
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# Copia il resto del codice
COPY --chown=user: . /app

EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]