caarleexx commited on
Commit
f5104ba
verified
1 Parent(s): 35cee90

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -19
Dockerfile CHANGED
@@ -1,6 +1,6 @@
1
  # ============================================================================
2
  # Dockerfile para Hugging Face Spaces - para.AI API v3.0
3
- # Com PostgreSQL tempor谩rio embutido (ideal para testes/demo)
4
  # ============================================================================
5
 
6
  FROM python:3.11-slim
@@ -15,42 +15,47 @@ ENV PYTHONUNBUFFERED=1 \
15
  PYTHONDONTWRITEBYTECODE=1 \
16
  PIP_NO_CACHE_DIR=1 \
17
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
18
- DEBIAN_FRONTEND=noninteractive \
19
- POSTGRES_VERSION=15
20
 
21
  # Definir diret贸rio de trabalho
22
  WORKDIR /app
23
 
24
  # ============================================================================
25
- # INSTALAR DEPEND脢NCIAS DO SISTEMA + POSTGRESQL
26
  # ============================================================================
27
  RUN apt-get update && apt-get install -y \
 
 
 
 
 
 
 
 
 
 
 
28
  # Build essentials
29
  gcc \
30
  g++ \
31
  make \
32
- # PostgreSQL
33
- postgresql-${POSTGRES_VERSION} \
34
- postgresql-client-${POSTGRES_VERSION} \
35
- postgresql-contrib-${POSTGRES_VERSION} \
36
  # Utilities
37
- curl \
38
- wget \
39
  procps \
40
- && rm -rf /var/lib/apt/lists/*
 
 
41
 
42
  # ============================================================================
43
  # CONFIGURAR POSTGRESQL
44
  # ============================================================================
45
- # Criar usu谩rio postgres se n茫o existir
46
- RUN useradd -m -s /bin/bash postgres || true
47
-
48
  # Criar diret贸rios para PostgreSQL
49
  RUN mkdir -p /var/lib/postgresql/data \
50
  /var/run/postgresql \
51
  /var/log/postgresql \
52
- && chown -R postgres:postgres /var/lib/postgresql \
53
- && chown -R postgres:postgres /var/run/postgresql \
54
  && chmod 2777 /var/run/postgresql
55
 
56
  # ============================================================================
@@ -65,7 +70,7 @@ RUN pip install --no-cache-dir -r requirements.txt
65
  COPY . .
66
 
67
  # ============================================================================
68
- # COPIAR SCRIPTS DE INICIALIZA脟脙O
69
  # ============================================================================
70
  COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
71
  COPY scripts/init-postgres.sh /init-postgres.sh
@@ -82,7 +87,7 @@ RUN mkdir -p /app/data/uploads \
82
  && chmod -R 755 /app
83
 
84
  # ============================================================================
85
- # CONFIGURA脟脮ES PADR脙O (podem ser sobrescritas por Secrets do HF)
86
  # ============================================================================
87
  ENV APP_ENV=production \
88
  HOST=0.0.0.0 \
@@ -100,7 +105,6 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
100
 
101
  # Expor portas
102
  EXPOSE 7860
103
- EXPOSE 5432
104
 
105
  # ============================================================================
106
  # ENTRYPOINT
 
1
  # ============================================================================
2
  # Dockerfile para Hugging Face Spaces - para.AI API v3.0
3
+ # Com PostgreSQL tempor谩rio embutido (CORRIGIDO para Debian Bookworm)
4
  # ============================================================================
5
 
6
  FROM python:3.11-slim
 
15
  PYTHONDONTWRITEBYTECODE=1 \
16
  PIP_NO_CACHE_DIR=1 \
17
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
18
+ DEBIAN_FRONTEND=noninteractive
 
19
 
20
  # Definir diret贸rio de trabalho
21
  WORKDIR /app
22
 
23
  # ============================================================================
24
+ # ADICIONAR REPOSIT脫RIO DO POSTGRESQL + INSTALAR DEPEND脢NCIAS
25
  # ============================================================================
26
  RUN apt-get update && apt-get install -y \
27
+ # Ferramentas b谩sicas
28
+ curl \
29
+ wget \
30
+ gnupg \
31
+ lsb-release \
32
+ && \
33
+ # Adicionar reposit贸rio oficial do PostgreSQL
34
+ echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
35
+ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
36
+ # Atualizar e instalar PostgreSQL
37
+ apt-get update && apt-get install -y \
38
  # Build essentials
39
  gcc \
40
  g++ \
41
  make \
42
+ # PostgreSQL 15
43
+ postgresql-15 \
44
+ postgresql-client-15 \
45
+ postgresql-contrib-15 \
46
  # Utilities
 
 
47
  procps \
48
+ && \
49
+ # Limpar cache
50
+ rm -rf /var/lib/apt/lists/*
51
 
52
  # ============================================================================
53
  # CONFIGURAR POSTGRESQL
54
  # ============================================================================
 
 
 
55
  # Criar diret贸rios para PostgreSQL
56
  RUN mkdir -p /var/lib/postgresql/data \
57
  /var/run/postgresql \
58
  /var/log/postgresql \
 
 
59
  && chmod 2777 /var/run/postgresql
60
 
61
  # ============================================================================
 
70
  COPY . .
71
 
72
  # ============================================================================
73
+ # COPIAR E PREPARAR SCRIPTS
74
  # ============================================================================
75
  COPY scripts/docker-entrypoint.sh /docker-entrypoint.sh
76
  COPY scripts/init-postgres.sh /init-postgres.sh
 
87
  && chmod -R 755 /app
88
 
89
  # ============================================================================
90
+ # CONFIGURA脟脮ES PADR脙O
91
  # ============================================================================
92
  ENV APP_ENV=production \
93
  HOST=0.0.0.0 \
 
105
 
106
  # Expor portas
107
  EXPOSE 7860
 
108
 
109
  # ============================================================================
110
  # ENTRYPOINT