caarleexx commited on
Commit
c2c4c6f
·
verified ·
1 Parent(s): 50ac08d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -50
Dockerfile CHANGED
@@ -1,75 +1,59 @@
1
- # ============================================================================
2
- # Dockerfile ALTERNATIVO - para.AI API v3.0 (SQLite para testes rápidos)
3
- # Imagem MUITO mais leve (~300MB vs 800MB)
4
- # ============================================================================
5
- #
6
- # ATENÇÃO: Esta versão usa SQLite para testes rápidos
7
- # Para produção, use Dockerfile principal com PostgreSQL
8
- #
9
- # ============================================================================
10
 
11
  FROM python:3.11-slim
12
 
 
13
  LABEL maintainer="para.AI Team"
14
- LABEL version="3.0.0-lite"
15
- LABEL description="API de análise jurisprudencial (versão leve com SQLite)"
16
 
17
  # Variáveis de ambiente
18
  ENV PYTHONUNBUFFERED=1 \
19
  PYTHONDONTWRITEBYTECODE=1 \
20
  PIP_NO_CACHE_DIR=1 \
21
- DEBIAN_FRONTEND=noninteractive
 
 
 
 
22
 
 
23
  WORKDIR /app
24
 
25
- # ============================================================================
26
- # INSTALAR DEPENDÊNCIAS MÍNIMAS DO SISTEMA
27
- # ============================================================================
 
28
  RUN apt-get update && apt-get install -y --no-install-recommends \
29
  gcc \
30
  curl \
31
  && rm -rf /var/lib/apt/lists/*
32
 
33
- # ============================================================================
34
- # INSTALAR DEPENDÊNCIAS PYTHON
35
- # ============================================================================
36
  COPY requirements.txt .
37
- RUN pip install --no-cache-dir -r requirements.txt && \
38
- pip install --no-cache-dir aiosqlite
39
 
40
- # ============================================================================
41
- # COPIAR CÓDIGO
42
- # ============================================================================
 
43
  COPY . .
44
 
45
- # ============================================================================
46
- # CRIAR DIRETÓRIOS
47
- # ============================================================================
48
- RUN mkdir -p /app/data/uploads \
49
- /app/data/outputs \
50
- /app/data/temp \
51
- /app/data/backups \
52
- /app/logs \
53
- && chmod -R 755 /app
54
 
55
- # ============================================================================
56
- # CONFIGURAÇÕES (SQLite)
57
- # ============================================================================
58
- ENV APP_ENV=production \
59
- HOST=0.0.0.0 \
60
- PORT=7860 \
61
- DATABASE_URL=sqlite:///app/data/para_ai.db \
62
- SQLITE_MODE=true
63
 
64
- # ============================================================================
65
- # HEALTH CHECK
66
- # ============================================================================
67
- HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \
68
- CMD curl -f http://localhost:7860/api/v1/health || exit 1
69
 
70
- EXPOSE 7860
 
 
71
 
72
- # ============================================================================
73
- # COMANDO
74
- # ============================================================================
75
- CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
 
1
+ # Dockerfile.lite - para.AI v3.0 com SQLite
2
+ # Build ~2min (vs ~8min com PostgreSQL)
3
+ # Imagem ~300MB (vs ~800MB com PostgreSQL)
 
 
 
 
 
 
4
 
5
  FROM python:3.11-slim
6
 
7
+ # Metadata
8
  LABEL maintainer="para.AI Team"
9
+ LABEL version="3.0.0-sqlite"
10
+ LABEL description="para.AI API - SQLite Test Version"
11
 
12
  # Variáveis de ambiente
13
  ENV PYTHONUNBUFFERED=1 \
14
  PYTHONDONTWRITEBYTECODE=1 \
15
  PIP_NO_CACHE_DIR=1 \
16
+ PIP_DISABLE_PIP_VERSION_CHECK=1 \
17
+ DEBIAN_FRONTEND=noninteractive \
18
+ APP_ENV=development \
19
+ DATABASE_TYPE=sqlite \
20
+ DATABASE_URL=sqlite:///./data/para_ai.db
21
 
22
+ # Criar diretórios
23
  WORKDIR /app
24
 
25
+ RUN mkdir -p /app/data /app/logs /app/data/files /app/data/uploads \
26
+ /app/data/outputs /app/data/temp /app/data/backups
27
+
28
+ # Instalar dependências mínimas do sistema
29
  RUN apt-get update && apt-get install -y --no-install-recommends \
30
  gcc \
31
  curl \
32
  && rm -rf /var/lib/apt/lists/*
33
 
34
+ # Copiar requirements
 
 
35
  COPY requirements.txt .
 
 
36
 
37
+ # Instalar dependências Python
38
+ RUN pip install --no-cache-dir -r requirements.txt
39
+
40
+ # Copiar código da aplicação
41
  COPY . .
42
 
43
+ # Criar arquivo SQLite vazio (será populado na primeira execução)
44
+ RUN touch /app/data/para_ai.db && chmod 666 /app/data/para_ai.db
 
 
 
 
 
 
 
45
 
46
+ # Expor porta
47
+ EXPOSE 7864
 
 
 
 
 
 
48
 
49
+ # Healthcheck
50
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
51
+ CMD curl -f http://localhost:8000/health || exit 1
 
 
52
 
53
+ # Script de inicialização
54
+ COPY scripts/docker-entrypoint-lite.sh /docker-entrypoint.sh
55
+ RUN chmod +x /docker-entrypoint.sh
56
 
57
+ # Comando de inicialização
58
+ ENTRYPOINT ["/docker-entrypoint.sh"]
59
+ CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7864", "--workers", "1"]