diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..29532cb --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +.venv +__pycache__ +*.pyc +*.duckdb* +.env* +!.env.example +.git +.gitea +.docs +docs +dbt_nba/target/ +dbt_nba/dbt_packages/ +dbt_nba/logs/ \ No newline at end of file diff --git a/.gitea/workflows/pipeline.yaml b/.gitea/workflows/pipeline.yaml index 85c22ab..fb2e274 100644 --- a/.gitea/workflows/pipeline.yaml +++ b/.gitea/workflows/pipeline.yaml @@ -42,3 +42,11 @@ jobs: export PATH="$HOME/.local/bin:/root/.local/bin:$PATH" chmod +x ./scripts/pipeline.sh ./scripts/db_storage.py ./scripts/pipeline.sh + + - name: Trigger Coolify Deployment Webhook (Optional) + if: env.COOLIFY_WEBHOOK_URL != '' + env: + COOLIFY_WEBHOOK_URL: ${{ secrets.COOLIFY_WEBHOOK_URL }} + run: | + echo "==> Triggering Coolify deployment webhook..." + curl -fsSL -X POST "$COOLIFY_WEBHOOK_URL" || echo "Webhook trigger skipped or failed" diff --git a/.gitignore b/.gitignore index e6029fc..8eff1c1 100644 --- a/.gitignore +++ b/.gitignore @@ -194,4 +194,6 @@ dbt_nba/logs/ AGENTS.md .agents -.claude \ No newline at end of file +.claude + +.env.old \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..66eb846 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,36 @@ +FROM python:3.12-slim + +WORKDIR /app + +# Install system dependencies (curl for uv, ca-certificates for HTTPS) +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +# Install uv package manager +RUN curl -LsSf https://astral.sh/uv/install.sh | sh +ENV PATH="/root/.local/bin:$PATH" + +# Copy dependency files and install into container virtualenv +COPY pyproject.toml uv.lock* ./ +RUN uv sync --frozen --no-install-project + +# Copy application files +COPY streamlit_app/ ./streamlit_app/ +COPY scripts/ ./scripts/ +COPY dbt_nba/reports/ ./dbt_nba/reports/ +COPY data/ ./data/ + +# Make scripts executable +RUN chmod +x scripts/*.sh scripts/*.py + +# Expose Streamlit default port +EXPOSE 8501 + +# Healthcheck to monitor Streamlit availability +HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ + CMD curl --fail http://localhost:8501/_stcore/health || exit 1 + +# Launch: smart sync DB from Cloudflare R2, then start Streamlit +CMD ["sh", "-c", "uv run python scripts/db_storage.py download && uv run streamlit run streamlit_app/app.py --server.port=8501 --server.address=0.0.0.0 --server.headless=true --server.enableCORS=false --server.enableXsrfProtection=false"] \ No newline at end of file