Spaces:
Sleeping
Sleeping
Marcos
commited on
Commit
·
9e80488
1
Parent(s):
f55c577
Deploy Virtual Girlfriend backend v1
Browse files- .dockerignore +8 -1
- Dockerfile +29 -26
- README.md +15 -6
- backend +0 -1
- backend-new/index.js +0 -1
- backend-new/package.json +0 -0
- backend-new/public/index.html +0 -0
- entrypoint.sh +0 -11
- frontend +0 -1
.dockerignore
CHANGED
@@ -38,4 +38,11 @@ wheels/
|
|
38 |
.Spotlight-V100
|
39 |
.Trashes
|
40 |
ehthumbs.db
|
41 |
-
Thumbs.db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
.Spotlight-V100
|
39 |
.Trashes
|
40 |
ehthumbs.db
|
41 |
+
Thumbs.db
|
42 |
+
|
43 |
+
# Node specific
|
44 |
+
backend/node_modules
|
45 |
+
backend/.env
|
46 |
+
backend/audios/*.mp3
|
47 |
+
backend/audios/*.wav
|
48 |
+
backend/audios/*.json
|
Dockerfile
CHANGED
@@ -1,39 +1,42 @@
|
|
1 |
-
FROM node:18
|
|
|
|
|
|
|
|
|
2 |
|
3 |
# Set environment variables
|
4 |
ENV NODE_ENV=production
|
|
|
5 |
|
6 |
-
# Create a non-root user
|
7 |
-
|
8 |
-
|
9 |
-
# Create app directory
|
10 |
-
WORKDIR /app
|
11 |
|
12 |
-
# Create
|
13 |
-
|
14 |
|
15 |
-
#
|
16 |
-
|
|
|
|
|
|
|
17 |
|
18 |
# Install dependencies
|
19 |
-
|
|
|
|
|
|
|
20 |
|
21 |
-
#
|
22 |
-
|
23 |
|
24 |
-
#
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
-
#
|
29 |
-
RUN echo '#!/bin/sh\ncd /app/backend\nnode index.js' > /app/entrypoint.sh
|
30 |
-
RUN chmod +x /app/entrypoint.sh
|
31 |
-
|
32 |
-
# Expose the port
|
33 |
EXPOSE 7860
|
34 |
|
35 |
-
#
|
36 |
-
|
37 |
-
|
38 |
-
# Set entrypoint to start the backend
|
39 |
-
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
1 |
+
FROM node:18-slim
|
2 |
+
|
3 |
+
# Install ffmpeg and other useful tools
|
4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg curl && \
|
5 |
+
apt-get clean && rm -rf /var/lib/apt/lists/*
|
6 |
|
7 |
# Set environment variables
|
8 |
ENV NODE_ENV=production
|
9 |
+
ENV PORT=7860
|
10 |
|
11 |
+
# Create a non-root user and switch to it
|
12 |
+
# Using the existing 'node' user that comes with the official node images
|
13 |
+
USER node
|
|
|
|
|
14 |
|
15 |
+
# Create app directory and set it as working directory
|
16 |
+
WORKDIR /home/node/app
|
17 |
|
18 |
+
# Copy package.json and package-lock.json (or yarn.lock) first
|
19 |
+
# This allows Docker to cache the npm install step if these files don't change
|
20 |
+
COPY --chown=node:node backend/package.json backend/package-lock.json* ./
|
21 |
+
# If you use yarn, uncomment the next line and comment out the npm ci line
|
22 |
+
# COPY --chown=node:node backend/yarn.lock ./
|
23 |
|
24 |
# Install dependencies
|
25 |
+
# Using npm ci for cleaner installs if package-lock.json is present
|
26 |
+
RUN npm ci --only=production
|
27 |
+
# If you use yarn, uncomment the next line and comment out the npm ci line
|
28 |
+
# RUN yarn install --production --frozen-lockfile
|
29 |
|
30 |
+
# Copy the rest of the application files from the backend directory
|
31 |
+
COPY --chown=node:node backend/ ./
|
32 |
|
33 |
+
# Create audios and public directories if they might not be copied (e.g., if empty or in .dockerignore of the source)
|
34 |
+
# The application tries to create them, but it's good practice if they are expected.
|
35 |
+
# However, COPY backend/ . should bring them if they exist in the source 'backend' directory.
|
36 |
+
# RUN mkdir -p audios public
|
37 |
|
38 |
+
# Expose the port the app runs on
|
|
|
|
|
|
|
|
|
39 |
EXPOSE 7860
|
40 |
|
41 |
+
# Command to run the application
|
42 |
+
CMD [ "node", "index.js" ]
|
|
|
|
|
|
README.md
CHANGED
@@ -1,15 +1,24 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: docker
|
7 |
app_port: 7860
|
8 |
---
|
9 |
|
10 |
-
#
|
11 |
|
12 |
-
This Space
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
## Features
|
15 |
|
|
|
1 |
---
|
2 |
+
title: Virtual Girlfriend Backend
|
3 |
+
emoji: 🤖
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: purple
|
6 |
sdk: docker
|
7 |
app_port: 7860
|
8 |
---
|
9 |
|
10 |
+
# Virtual Girlfriend Backend
|
11 |
|
12 |
+
This Space hosts the backend for the R3F Virtual Girlfriend application.
|
13 |
+
It provides APIs for chat, voice interaction, and text-to-speech with lip sync.
|
14 |
+
|
15 |
+
## Endpoints
|
16 |
+
|
17 |
+
- `/chat`: Handles text-based chat interactions.
|
18 |
+
- `/voice-chat`: Handles voice-based chat interactions.
|
19 |
+
- `/voices`: Lists available voices from ElevenLabs.
|
20 |
+
|
21 |
+
(You can add more details about your API, how to use it, etc.)
|
22 |
|
23 |
## Features
|
24 |
|
backend
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit 99a28296d9003b3a6a526e18cc56807e5f4aa54d
|
|
|
|
backend-new/index.js
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
import express from 'express';
|
|
|
|
backend-new/package.json
DELETED
File without changes
|
backend-new/public/index.html
DELETED
File without changes
|
entrypoint.sh
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
#!/bin/sh
|
2 |
-
set -e
|
3 |
-
|
4 |
-
# Hugging Face Spaces will route traffic to the first process that binds to the PORT env variable (default 7860)
|
5 |
-
# Ensure we are in the backend directory and start the server.
|
6 |
-
cd /app/backend
|
7 |
-
|
8 |
-
# Echo for debugging
|
9 |
-
echo "Starting backend on PORT=${PORT:-7860}"
|
10 |
-
|
11 |
-
exec node index.js
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
Subproject commit 37024ae3bc86f9fc7b98ba03c8fae57c0af3fa0d
|
|
|
|