-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
60 lines (48 loc) · 1.56 KB
/
Dockerfile
File metadata and controls
60 lines (48 loc) · 1.56 KB
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
52
53
54
55
56
57
58
59
60
# Usar una imagen base de Python
# FROM --platform=linux/amd64 python:3.11-slim
FROM python:3.11-slim
ENV USE_NNPACK=0
ENV HF_HOME=/app/.cache/huggingface
ENV OMP_NUM_THREADS=1
ENV OPENBLAS_NUM_THREADS=1
ENV MKL_NUM_THREADS=1
ENV NUMEXPR_NUM_THREADS=1
# Establecer el directorio de trabajo en el contenedor
WORKDIR /app
# Instalar dependencias del sistema necesarias para spaCy, Transformers y EasyOCR
RUN apt-get update && apt-get install -y \
git \
build-essential \
python3-dev \
gcc \
cmake \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libffi-dev \
libssl-dev \
libblas-dev \
liblapack-dev \
libopenblas-dev \
gfortran \
&& rm -rf /var/lib/apt/lists/*
# Copiar los archivos necesarios al contenedor
COPY requirements.txt requirements.txt
# COPY app.py app.py
# Instalar las dependencias
RUN python -m pip install --upgrade pip
# RUN pip install --upgrade pip setuptools
RUN pip install --upgrade setuptools pip wheel cython meson
# Evitar fallos al compilar blis en ARM
ENV BLIS_ARCH=generic
RUN pip install --no-cache-dir -r requirements.txt
# Descargar modelos de spaCy y Transformers en la imagen
RUN python -m spacy download es_core_news_lg
RUN python -c "from transformers import pipeline; pipeline('ner', model='dbmdz/bert-large-cased-finetuned-conll03-english')"
COPY . .
# Exponer el puerto en el que correrá Flask
EXPOSE 5002
# Comando para ejecutar la API
# CMD ["python", "app.py"]
CMD ["gunicorn", "--workers", "2", "--threads", "2", "--timeout", "600", "--bind", "0.0.0.0:5002", "app:create_app()"]