MSF commited on
Commit
de96384
·
1 Parent(s): 4bbaf1c

feat: Configure Docker for Hugging Face deployment

Browse files

Set up a multi-stage Dockerfile to build and serve the application using Nginx.
Includes a custom Nginx configuration to listen on port 7860 and serve static files.
Updates README.md to reflect deployment instructions and features.
Adds .dockerignore to exclude unnecessary files during build.

Files changed (4) hide show
  1. .dockerignore +15 -0
  2. Dockerfile +31 -0
  3. README.md +24 -13
  4. nginx.conf +16 -0
.dockerignore ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ node_modules
2
+ dist
3
+ .git
4
+ .gitignore
5
+ Dockerfile
6
+ nginx.conf
7
+ README.md
8
+ .env
9
+ .env.example
10
+ .env.local
11
+ npm-debug.log
12
+ yarn-debug.log
13
+ yarn-error.log
14
+ .vscode
15
+ .idea
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build stage
2
+ FROM node:20-slim AS build
3
+
4
+ WORKDIR /app
5
+
6
+ # Copy package files
7
+ COPY package*.json ./
8
+
9
+ # Install dependencies
10
+ RUN npm install
11
+
12
+ # Copy project files
13
+ COPY . .
14
+
15
+ # Build the application
16
+ RUN npm run build
17
+
18
+ # Production stage
19
+ FROM nginx:alpine
20
+
21
+ # Copy the build output to replace the default nginx contents.
22
+ COPY --from=build /app/dist /usr/share/nginx/html
23
+
24
+ # Copy custom nginx configuration
25
+ COPY nginx.conf /etc/nginx/conf.d/default.conf
26
+
27
+ # Hugging Face Spaces uses port 7860 by default
28
+ EXPOSE 7860
29
+
30
+ # Start nginx
31
+ CMD ["nginx", "-g", "daemon off;"]
README.md CHANGED
@@ -1,20 +1,31 @@
1
- <div align="center">
2
- <img width="1200" height="475" alt="GHBanner" src="https://github.com/user-attachments/assets/0aa67016-6eaf-458a-adb2-6e31a0763ed6" />
3
- </div>
 
 
 
 
 
 
4
 
5
- # Run and deploy your AI Studio app
6
 
7
- This contains everything you need to run your app locally.
8
 
9
- View your app in AI Studio: https://ai.studio/apps/93231555-9e1d-45e8-aa4e-490db484e57a
10
 
11
- ## Run Locally
12
 
13
- **Prerequisites:** Node.js
 
 
 
14
 
 
15
 
16
- 1. Install dependencies:
17
- `npm install`
18
- 2. Set the `GEMINI_API_KEY` in [.env.local](.env.local) to your Gemini API key
19
- 3. Run the app:
20
- `npm run dev`
 
 
1
+ ---
2
+ title: Quadrant Chart Tool
3
+ emoji: 📊
4
+ colorFrom: indigo
5
+ colorTo: slate
6
+ sdk: docker
7
+ app_port: 7860
8
+ pinned: false
9
+ ---
10
 
11
+ # Quadrant Chart Tool
12
 
13
+ A professional tool for visualizing campaign performance data in a quadrant chart format.
14
 
15
+ ## Deployment on Hugging Face Spaces
16
 
17
+ This project is configured to run as a Docker space on Hugging Face.
18
 
19
+ 1. Create a new Space on Hugging Face.
20
+ 2. Select **Docker** as the SDK.
21
+ 3. Upload all files from this project.
22
+ 4. The `Dockerfile` will automatically build and serve the application on port 7860.
23
 
24
+ ## Features
25
 
26
+ - **Excel Support:** Upload `.xlsx` or `.xls` files.
27
+ - **Dynamic Axes:** Choose any numeric column for X and Y axes.
28
+ - **Multi-select Grouping:** Generate separate charts for different categories (e.g., Platform + Category).
29
+ - **Point Interaction:** Click points to change colors or remove them.
30
+ - **Point Size:** Scale points based on a third metric (e.g., Spend).
31
+ - **Export:** Copy charts to clipboard or save as PNG.
nginx.conf ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ server {
2
+ listen 7860;
3
+ server_name localhost;
4
+
5
+ location / {
6
+ root /usr/share/nginx/html;
7
+ index index.html index.htm;
8
+ try_files $uri $uri/ /index.html;
9
+ }
10
+
11
+ # Optional: Handle errors
12
+ error_page 500 502 503 504 /50x.html;
13
+ location = /50x.html {
14
+ root /usr/share/nginx/html;
15
+ }
16
+ }