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..74f8e8c 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. @@ -111,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 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"; + } +}