From 8d4ca9e01d6ff85bcf38f5f032f96f6ea6216d9a Mon Sep 17 00:00:00 2001 From: Gourav Shah Date: Sun, 21 Sep 2025 12:27:31 +0530 Subject: [PATCH 1/3] Update goose.yml google gemini --- .github/workflows/goose.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/goose.yml b/.github/workflows/goose.yml index 9b59a66..b836213 100644 --- a/.github/workflows/goose.yml +++ b/.github/workflows/goose.yml @@ -11,7 +11,7 @@ permissions: issues: write env: - PROVIDER_API_KEY: ${{ secrets.GROQ_API_KEY }} + PROVIDER_API_KEY: ${{ secrets.GOOGLE_API_KEY }} PR_NUMBER: ${{ github.event.pull_request.number }} GH_TOKEN: ${{ github.token }} @@ -47,8 +47,8 @@ jobs: run: | mkdir -p ~/.config/goose cat > ~/.config/goose/config.yaml <<'EOF' - GOOSE_PROVIDER: groq - GOOSE_MODEL: llama-3.3-70b-versatile + GOOSE_PROVIDER: google + GOOSE_MODEL: gemini-2.0-flash-exp keyring: false EOF @@ -69,7 +69,7 @@ jobs: - name: Run Goose and filter output env: - GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} + GROQ_API_KEY: ${{ secrets.GOOGLE_API_KEY }} run: | goose run --instructions instructions.txt \ | sed -E 's/\x1B\[[0-9;]*[mK]//g' \ From fbf3d3bdc7dd35b118d3531f65bbc5db85fc9136 Mon Sep 17 00:00:00 2001 From: Gourav Shah Date: Sun, 21 Sep 2025 12:29:46 +0530 Subject: [PATCH 2/3] Update goose.yml --- .github/workflows/goose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/goose.yml b/.github/workflows/goose.yml index b836213..d281338 100644 --- a/.github/workflows/goose.yml +++ b/.github/workflows/goose.yml @@ -69,7 +69,7 @@ jobs: - name: Run Goose and filter output env: - GROQ_API_KEY: ${{ secrets.GOOGLE_API_KEY }} + GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }} run: | goose run --instructions instructions.txt \ | sed -E 's/\x1B\[[0-9;]*[mK]//g' \ From 3f39f3c938ba878d295dcdc8522ce1a0c8057eff Mon Sep 17 00:00:00 2001 From: Gourav Shah Date: Sun, 21 Sep 2025 12:39:56 +0530 Subject: [PATCH 3/3] Create Dockerfile --- Dockerfile | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9298310 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,69 @@ +# syntax=docker/dockerfile:1 +# BuildKit optimized Dockerfile with advanced caching and multi-arch support + +ARG TARGETPLATFORM +ARG BUILDPLATFORM +ARG TARGETOS +ARG TARGETARCH + +# Stage 1: Dependencies stage with cache mounts +FROM --platform=$BUILDPLATFORM python:3.11-slim AS dependencies + +WORKDIR /app + +# Use cache mount for apt packages +RUN --mount=type=cache,target=/var/cache/apt \ + --mount=type=cache,target=/var/lib/apt \ + apt-get update && apt-get install -y \ + gcc \ + python3-dev + +# Use cache mount for pip packages +COPY requirements.txt . +RUN --mount=type=cache,target=/root/.cache/pip \ + pip install --user -r requirements.txt + +# Stage 2: Model training stage +FROM dependencies AS trainer + +COPY train.py . + +# Train the model with cache mount for any downloads +RUN --mount=type=cache,target=/tmp \ + python train.py + +# Stage 3: Final production stage +FROM --platform=$TARGETPLATFORM python:3.11-slim AS production + +# Display build info for debugging +RUN echo "Building for platform: $TARGETPLATFORM, architecture: $TARGETARCH" + +# Create non-root user +RUN useradd --create-home --shell /bin/bash mluser + +WORKDIR /app + +# Copy Python packages from dependencies stage +COPY --from=dependencies /root/.local /home/mluser/.local + +# Copy application files +COPY app.py . +COPY requirements.txt . + +# Copy trained models from trainer stage +COPY --from=trainer /app/*.pkl ./ + +# Set proper ownership +RUN chown -R mluser:mluser /app +USER mluser + +# Update PATH for user-installed packages +ENV PATH=/home/mluser/.local/bin:$PATH + +# Health check with improved reliability +HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ + CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:7860', timeout=5)" || exit 1 + +EXPOSE 7860 + +CMD ["python", "app.py"]