Spaces:
Sleeping
Sleeping
MSF commited on
Commit ·
de96384
1
Parent(s): 4bbaf1c
feat: Configure Docker for Hugging Face deployment
Browse filesSet 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.
- .dockerignore +15 -0
- Dockerfile +31 -0
- README.md +24 -13
- 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 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
#
|
| 6 |
|
| 7 |
-
|
| 8 |
|
| 9 |
-
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
| 14 |
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
|
|
|
|
|
| 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 |
+
}
|