From b3753e768c95b069d78ab247ab730b8354b5024e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A1bio=20Cavalcanti?= Date: Thu, 12 Dec 2024 18:52:35 -0300 Subject: [PATCH] =?UTF-8?q?ajustes=20de=20inicializa=C3=A7=C3=A3o,=20adici?= =?UTF-8?q?onado=20orienta=C3=A7=C3=B5es=20de=20uso=20da=20API=20no=20Mana?= =?UTF-8?q?ger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 9 +++++++-- start.sh | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1166dcd..e08dbeb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ # Usar uma imagem oficial do Python como base FROM python:3.10-slim -# Instalar dependências do sistema +# Instalar dependências do sistema, incluindo redis-tools RUN apt-get update && apt-get install -y --no-install-recommends \ + redis-tools \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Definir o diretório de trabalho @@ -22,10 +23,14 @@ RUN mkdir -p /app/static COPY static/ /app/static/ # Garantir permissões de execução ao script inicial +COPY start.sh . RUN chmod +x start.sh +# Converter possíveis caracteres de retorno de carro do Windows +RUN apt-get update && apt-get install -y dos2unix && dos2unix start.sh && apt-get remove -y dos2unix && apt-get autoremove -y && apt-get clean + # Expor as portas usadas pela aplicação EXPOSE 8005 8501 # Definir o comando inicial -CMD ["./start.sh"] \ No newline at end of file +CMD ["/bin/bash", "/app/start.sh"] \ No newline at end of file diff --git a/start.sh b/start.sh index e37f6ab..c01aeb8 100644 --- a/start.sh +++ b/start.sh @@ -7,8 +7,16 @@ initialize_redis_config() { redis-cli -h $REDIS_HOST -p $REDIS_PORT SET PROCESS_GROUP_MESSAGES "false" redis-cli -h $REDIS_HOST -p $REDIS_PORT SET PROCESS_SELF_MESSAGES "true" redis-cli -h $REDIS_HOST -p $REDIS_PORT SET DEBUG_MODE "false" + redis-cli -h $REDIS_HOST -p $REDIS_PORT SET API_DOMAIN "$API_DOMAIN" } +# Aguardar o Redis estar pronto +echo "Aguardando o Redis ficar disponível..." +until redis-cli -h $REDIS_HOST -p $REDIS_PORT PING; do + echo "Redis não está pronto - aguardando..." + sleep 5 +done + # Inicializar configurações no Redis initialize_redis_config