gaialive commited on
Commit
d49e99c
·
verified ·
1 Parent(s): 529007b

Upload 7 files

Browse files
Files changed (7) hide show
  1. Dockerfile +40 -0
  2. backend/1.txt +0 -0
  3. docker-compose.yml +45 -0
  4. frontend/2.txt +0 -0
  5. huggingface.yml +3 -0
  6. nginx.conf +30 -0
  7. requirements.txt +6 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Multi-stage build for frontend
2
+ FROM node:18-alpine as frontend-build
3
+
4
+ # Set the working directory
5
+ WORKDIR /app
6
+
7
+ # Copy frontend files
8
+ COPY frontend/package*.json ./
9
+ RUN npm install
10
+ COPY frontend/ ./
11
+ RUN npm run build
12
+
13
+ # Backend build
14
+ FROM node:18-alpine as backend-build
15
+ WORKDIR /app
16
+ COPY backend/package*.json ./
17
+ RUN npm install
18
+ COPY backend/ ./
19
+
20
+ # Final stage
21
+ FROM node:18-alpine
22
+
23
+ # Install nginx
24
+ RUN apk add --no-cache nginx
25
+
26
+ # Copy frontend build
27
+ COPY --from=frontend-build /app/dist /var/www/html
28
+
29
+ # Copy nginx config
30
+ COPY nginx.conf /etc/nginx/nginx.conf
31
+
32
+ # Setup backend
33
+ WORKDIR /app
34
+ COPY --from=backend-build /app ./
35
+
36
+ # Expose ports
37
+ EXPOSE 80 3000
38
+
39
+ # Start both services
40
+ CMD nginx && npm start
backend/1.txt ADDED
File without changes
docker-compose.yml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.8'
2
+ services:
3
+ db:
4
+ image: postgres:17
5
+ restart: always
6
+ environment:
7
+ POSTGRES_USER: n4sm_user
8
+ POSTGRES_PASSWORD: securepass
9
+ POSTGRES_DB: n4sm
10
+ ports:
11
+ - '5432:5432'
12
+ volumes:
13
+ - db-data:/var/lib/postgresql/data
14
+ backend:
15
+ build:
16
+ context: ./backend
17
+ dockerfile: Dockerfile
18
+ depends_on:
19
+ - db
20
+ ports:
21
+ - '3000:3000'
22
+ environment:
23
+ - DATABASE_URL=postgresql://n4sm_user:securepass@db:5432/n4sm
24
+ - NODE_ENV=production
25
+ volumes:
26
+ - ./backend:/app
27
+ - /app/node_modules
28
+ frontend:
29
+ build:
30
+ context: ./frontend
31
+ dockerfile: Dockerfile
32
+ depends_on:
33
+ - backend
34
+ ports:
35
+ - '5173:5173'
36
+ environment:
37
+ - NODE_ENV=production
38
+ volumes:
39
+ - ./frontend:/app
40
+ - /app/node_modules
41
+ stdin_open: true
42
+ tty: true
43
+
44
+ volumes:
45
+ db-data:
frontend/2.txt ADDED
File without changes
huggingface.yml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Hugging Face Space configuration
2
+ name: n4sm-platform
3
+ sdk: docker
nginx.conf ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ events {
2
+ worker_connections 1024;
3
+ }
4
+
5
+ http {
6
+ include /etc/nginx/mime.types;
7
+
8
+ upstream backend {
9
+ server localhost:3000;
10
+ }
11
+
12
+ server {
13
+ listen 80;
14
+ server_name localhost;
15
+ root /var/www/html;
16
+ index index.html;
17
+
18
+ location / {
19
+ try_files $uri $uri/ /index.html;
20
+ }
21
+
22
+ location /api {
23
+ proxy_pass http://backend;
24
+ proxy_set_header Host $host;
25
+ proxy_set_header X-Real-IP $remote_addr;
26
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
27
+ proxy_set_header X-Forwarded-Proto $scheme;
28
+ }
29
+ }
30
+ }
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ # This is a placeholder requirements.txt file for Hugging Face Spaces
2
+ # Since we're using Node.js, we don't actually need Python dependencies
3
+ # But Hugging Face Spaces requires this file for Docker-based spaces
4
+
5
+ # For Node.js Docker spaces, we only need to specify the Dockerfile
6
+ # The actual dependencies are handled in package.json files