fix: Dockerfile references app.py instead of missing train.py, add gradio
Browse files- Dockerfile +18 -20
Dockerfile
CHANGED
|
@@ -1,36 +1,34 @@
|
|
| 1 |
-
# Usa uma imagem base mais recente e suportada
|
| 2 |
FROM python:3.9-slim-bookworm
|
| 3 |
|
| 4 |
-
# Define o diretório de trabalho
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
RUN apt-get update && apt-get install -y git git-lfs && git-lfs install
|
|
|
|
|
|
|
| 9 |
RUN git clone https://huggingface.co/spaces/Finish-him/prometheus-embedding-generator ./dados && cd dados && git lfs pull
|
| 10 |
|
| 11 |
-
#
|
| 12 |
COPY requirements.txt .
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
|
| 15 |
-
#
|
| 16 |
ENV HF_HOME=/app/cache/huggingface
|
| 17 |
ENV SENTENCE_TRANSFORMERS_HOME=/app/cache/torch
|
| 18 |
-
RUN mkdir -p $HF_HOME
|
| 19 |
-
|
| 20 |
-
# Pré-aquece o cache com o modelo e5-large
|
| 21 |
-
RUN python -c "import os; from sentence_transformers import SentenceTransformer; SentenceTransformer('intfloat/multilingual-e5-large', cache_folder=os.environ.get('SENTENCE_TRANSFORMERS_HOME', '/app/cache/torch'))"
|
| 22 |
|
| 23 |
-
# -
|
|
|
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
|
| 27 |
-
RUN mkdir -p /app/dados_extraidos && \
|
| 28 |
-
mkdir -p /app/output && \
|
| 29 |
chown -R 1000:1000 /app/dados_extraidos /app/output /app/cache
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
COPY
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
# Executa o script e, após o término, mantém o contêiner a correr.
|
| 36 |
-
CMD ["sh", "-c", "python train.py && sleep infinity"]
|
|
|
|
|
|
|
| 1 |
FROM python:3.9-slim-bookworm
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install git + LFS for data cloning
|
| 6 |
+
RUN apt-get update && apt-get install -y git git-lfs && git-lfs install && rm -rf /var/lib/apt/lists/*
|
| 7 |
+
|
| 8 |
+
# Clone data files from the space repo
|
| 9 |
RUN git clone https://huggingface.co/spaces/Finish-him/prometheus-embedding-generator ./dados && cd dados && git lfs pull
|
| 10 |
|
| 11 |
+
# Python deps
|
| 12 |
COPY requirements.txt .
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
|
| 15 |
+
# Cache dir for models
|
| 16 |
ENV HF_HOME=/app/cache/huggingface
|
| 17 |
ENV SENTENCE_TRANSFORMERS_HOME=/app/cache/torch
|
| 18 |
+
RUN mkdir -p $HF_HOME $SENTENCE_TRANSFORMERS_HOME
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
# Pre-download model
|
| 21 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('intfloat/multilingual-e5-large', cache_folder='/app/cache/torch')"
|
| 22 |
|
| 23 |
+
# Create output dirs with proper permissions
|
| 24 |
+
RUN mkdir -p /app/dados_extraidos /app/output && \
|
|
|
|
|
|
|
| 25 |
chown -R 1000:1000 /app/dados_extraidos /app/output /app/cache
|
| 26 |
|
| 27 |
+
# Copy the actual app file (was train.py, now app.py)
|
| 28 |
+
COPY app.py .
|
| 29 |
+
|
| 30 |
+
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 31 |
+
ENV GRADIO_SERVER_PORT="7860"
|
| 32 |
+
EXPOSE 7860
|
| 33 |
|
| 34 |
+
CMD ["python", "app.py"]
|
|
|
|
|
|