diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1ffb50d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,41 @@ +name: CI - Argus IA + +on: + push: + branches: [ "main", "develop" ] + pull_request: + branches: [ "main", "develop" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout do código + uses: actions/checkout@v3 + + - name: Configurar Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Instalar dependências + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt || true + + - name: Rodar testes (opcional – se adicionar testes) + run: | + echo "Nenhum teste configurado por enquanto" + continue-on-error: true + + - name: Build Docker + uses: docker/setup-buildx-action@v2 + + - name: Construir imagem Docker + run: | + docker build -t argusia . + + - name: Verificar sucesso do build + run: | + echo "Build do Docker finalizado com sucesso!" diff --git a/Dockerfile b/Dockerfile index 47ee3f1..3a39995 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,12 @@ -# Use uma imagem oficial do Python FROM python:3.10-slim -# Defina o diretório de trabalho dentro do container +# Instalar dependências do sistema para psycopg2 +RUN apt-get update && apt-get install -y \ + gcc \ + postgresql-client \ + libpq-dev \ + && rm -rf /var/lib/apt/lists/* + WORKDIR /app # Variáveis de ambiente @@ -18,9 +23,8 @@ RUN apt-get update && apt-get install -y \ # Copie os arquivos de requirements e instale as dependências COPY requirements.txt . RUN pip install --upgrade pip -RUN pip install -r requirements.txt +RUN pip install --no-cache-dir -r requirements.txt -# Copie todo o projeto para dentro do container COPY . . # Coletar arquivos estáticos (importante para Django) @@ -30,4 +34,4 @@ RUN python manage.py collectstatic --noinput EXPOSE 8000 # Comando para rodar o servidor Django com Gunicorn -CMD ["gunicorn", "--bind", "0.0.0.0:8000", "argus_ia.wsgi:application"] \ No newline at end of file +CMD ["gunicorn", "--bind", "0.0.0.0:8000", "argus_ia.wsgi:application"] diff --git a/argus_ia/settings.py b/argus_ia/settings.py index 9454b58..fbaace4 100644 --- a/argus_ia/settings.py +++ b/argus_ia/settings.py @@ -134,4 +134,4 @@ SECURE_HSTS_PRELOAD = True # Configuração de porta -PORT = os.environ.get('PORT', 8000) \ No newline at end of file +PORT = os.environ.get('PORT', 8000)