From ac45e9366fae3046600122d82e12cb30e858dc5a Mon Sep 17 00:00:00 2001 From: Chris H Date: Sat, 30 May 2026 17:22:50 -0700 Subject: [PATCH 1/2] frontend works on cloud run --- .dockerignore | 10 ++++++++++ Dockerfile | 26 ++++++++++++++++++++++++++ README.md | 2 ++ nginx.conf | 17 +++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..1910180 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +node_modules +frontend/node_modules +backend/venv +frontend/dist +.env +.git +.gitignore +README.md +Dockerfile.* +.dockerignore diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..81eb91f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Build stage +FROM node:20-alpine AS build +WORKDIR /app + +# Install dependencies +COPY frontend/package*.json ./frontend/ +WORKDIR /app/frontend +RUN npm install + +# Copy source code and build +COPY frontend/ ./ +RUN npm run build + +# Production stage +FROM nginx:alpine + +# Copy custom nginx config +COPY nginx.conf /etc/nginx/conf.d/default.conf + +# Copy built assets from build stage +COPY --from=build /app/frontend/dist /usr/share/nginx/html + +# Cloud Run expects the container to listen on port 8080 by default +EXPOSE 8080 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/README.md b/README.md index 44444cb..d2db1c8 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ > **QuackHacks 2026** — AI-powered precision agriculture platform built with real-world farm data. +Google Cloud Run Deployment: https://frontend-1001552662140.us-west2.run.app/ + HarvestEye is an intelligent farm monitoring and analysis system that combines **3D Gaussian Splatting** visualization with a **dual-agent Gemini AI architecture** to give farmers actionable, real-time insights on crop health, weed threats, soil conditions, and environmental conditions — all rendered in an immersive 3D farm interface. We went **in person to multiple farms** to collect real-world data to power the platform. diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..88e6bd6 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,17 @@ +server { + listen 8080; + + # Handle routing for single page application + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; + } + + # Optional: Cache static assets + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { + root /usr/share/nginx/html; + expires 30d; + add_header Cache-Control "public, no-transform"; + } +} From cf5e717acd68764da88175ea74f76abfd1c780ba Mon Sep 17 00:00:00 2001 From: Chris H Date: Sat, 30 May 2026 17:49:27 -0700 Subject: [PATCH 2/2] shell script to redeploy google cloud. update read me --- README.md | 8 ++++++++ deploy-frontend.sh | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100755 deploy-frontend.sh diff --git a/README.md b/README.md index d2db1c8..74f8e8c 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,14 @@ npm run dev The app will be available at `http://localhost:5173`. +### 3. Deployment (Cloud Run) + +To deploy updates to the frontend on Google Cloud Run, simply execute the deployment script from the root directory: + +```bash +./deploy-frontend.sh +``` + --- ## 🤖 API Usage diff --git a/deploy-frontend.sh b/deploy-frontend.sh new file mode 100755 index 0000000..2831650 --- /dev/null +++ b/deploy-frontend.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Deploy from source +gcloud run deploy frontend --source . --port 8080 --allow-unauthenticated --project uoo-quackathon26eug-8256 + +# Rename it back +mv Dockerfile Dockerfile.frontend