Spaces:
Running
Running
Gabriel Vidal-Ayrinhac
commited on
Commit
·
a04c70d
1
Parent(s):
7d6d833
wip
Browse files- Dockerfile +9 -5
- Makefile +15 -3
- WebGLBuild/Build/WebGLBuild.data +2 -2
- WebGLBuild/Build/WebGLBuild.wasm +2 -2
- nginx.conf +48 -17
- supervisord.conf +1 -2
Dockerfile
CHANGED
@@ -1,15 +1,18 @@
|
|
1 |
ARG MISTRAL_API_KEY
|
2 |
ARG ELEVENLABS_API_KEY
|
3 |
-
ARG
|
|
|
4 |
ARG API_BASE_PATH=/app
|
5 |
|
6 |
# Use Python base image as the primary environment
|
7 |
FROM python:3.10-alpine AS final
|
8 |
|
9 |
-
RUN apk add --no-cache supervisor
|
10 |
|
11 |
RUN adduser -D -u 1000 user
|
12 |
-
|
|
|
|
|
13 |
ENV HOME=/home/user \
|
14 |
PATH=/home/user/.local/bin:$PATH
|
15 |
|
@@ -23,12 +26,13 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
23 |
COPY --chown=user ./src /app
|
24 |
COPY --chown=user ./WebGLBuild /unity
|
25 |
|
26 |
-
COPY
|
|
|
27 |
|
28 |
# Expose the port
|
29 |
EXPOSE 8080
|
30 |
|
31 |
-
# Copy
|
32 |
COPY --chown=user supervisord.conf /etc/supervisord.conf
|
33 |
|
34 |
# Start both services using supervisord
|
|
|
1 |
ARG MISTRAL_API_KEY
|
2 |
ARG ELEVENLABS_API_KEY
|
3 |
+
ARG CUSTOM_API_URL=https://mistral-ai-game-jam-team15.hf.space/api
|
4 |
+
ARG HOST=mistral-ai-game-jam-team15.hf.space
|
5 |
ARG API_BASE_PATH=/app
|
6 |
|
7 |
# Use Python base image as the primary environment
|
8 |
FROM python:3.10-alpine AS final
|
9 |
|
10 |
+
RUN apk add --no-cache supervisor nginx
|
11 |
|
12 |
RUN adduser -D -u 1000 user
|
13 |
+
RUN mkdir -p /home/user/nginx /home/user/nginx/tmp
|
14 |
+
RUN chown -R user:user /home/user
|
15 |
+
|
16 |
ENV HOME=/home/user \
|
17 |
PATH=/home/user/.local/bin:$PATH
|
18 |
|
|
|
26 |
COPY --chown=user ./src /app
|
27 |
COPY --chown=user ./WebGLBuild /unity
|
28 |
|
29 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
30 |
+
|
31 |
|
32 |
# Expose the port
|
33 |
EXPOSE 8080
|
34 |
|
35 |
+
# Copy supervisord config to manage both processes (Nginx & Uvicorn/Flask/etc.)
|
36 |
COPY --chown=user supervisord.conf /etc/supervisord.conf
|
37 |
|
38 |
# Start both services using supervisord
|
Makefile
CHANGED
@@ -1,17 +1,29 @@
|
|
|
|
|
|
|
|
|
|
1 |
build:
|
2 |
docker build -t team15:latest .
|
3 |
|
4 |
run: # run source .env file for api keys
|
5 |
-
docker run -p 8080:8080
|
6 |
-e MISTRAL_API_KEY=$(MISTRAL_API_KEY) \
|
7 |
-e ELEVENLABS_API_KEY=$(ELEVENLABS_API_KEY) \
|
8 |
-
-e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
team15:latest
|
10 |
|
11 |
dev:
|
12 |
supervisord -c supervisord.dev.conf
|
13 |
|
14 |
-
|
15 |
dev.api:
|
16 |
fastapi dev src/hackathon/server/server.py --host 0.0.0.0 --port 3000
|
17 |
|
|
|
1 |
+
include .env
|
2 |
+
export $(shell sed 's/=.*//' .env)
|
3 |
+
|
4 |
+
|
5 |
build:
|
6 |
docker build -t team15:latest .
|
7 |
|
8 |
run: # run source .env file for api keys
|
9 |
+
docker run -p 8080:8080 \
|
10 |
-e MISTRAL_API_KEY=$(MISTRAL_API_KEY) \
|
11 |
-e ELEVENLABS_API_KEY=$(ELEVENLABS_API_KEY) \
|
12 |
+
-e CUSTOM_API_URL=$(CUSTOM_API_URL) \
|
13 |
+
--user=1000:1000 \
|
14 |
+
team15:latest
|
15 |
+
|
16 |
+
run.dev:
|
17 |
+
docker run -p 8080:8080 \
|
18 |
+
-e MISTRAL_API_KEY=$(MISTRAL_API_KEY) \
|
19 |
+
-e ELEVENLABS_API_KEY=$(ELEVENLABS_API_KEY) \
|
20 |
+
-e CUSTOM_API_URL=localhost:8080/api \
|
21 |
+
--user=1000:1000 \
|
22 |
team15:latest
|
23 |
|
24 |
dev:
|
25 |
supervisord -c supervisord.dev.conf
|
26 |
|
|
|
27 |
dev.api:
|
28 |
fastapi dev src/hackathon/server/server.py --host 0.0.0.0 --port 3000
|
29 |
|
WebGLBuild/Build/WebGLBuild.data
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:db596f4f5ad6d90c5ea09fb0dd35e17f63382652dba2b86048ed56ec2dcbab34
|
3 |
+
size 44342525
|
WebGLBuild/Build/WebGLBuild.wasm
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ad46145c8de73bab6159f047a8a0a17aac5b10f4e5d2d270aa56045ffe136755
|
3 |
+
size 36937944
|
nginx.conf
CHANGED
@@ -1,26 +1,57 @@
|
|
1 |
-
server {
|
2 |
-
listen 8080;
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
root /unity;
|
6 |
index index.html;
|
7 |
-
try_files $uri $uri/ /index.html;
|
8 |
-
}
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
18 |
}
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
}
|
26 |
}
|
|
|
|
|
|
|
1 |
|
2 |
+
worker_processes auto;
|
3 |
+
|
4 |
+
error_log /home/user/nginx/error.log warn;
|
5 |
+
pid /home/user/nginx/nginx.pid;
|
6 |
+
|
7 |
+
events {
|
8 |
+
worker_connections 1024;
|
9 |
+
}
|
10 |
+
|
11 |
+
http {
|
12 |
+
# Include the default mime types (includes .wasm, .js, etc.).
|
13 |
+
include /etc/nginx/mime.types;
|
14 |
+
default_type application/octet-stream;
|
15 |
+
client_body_temp_path /home/user/nginx/tmp/client_body;
|
16 |
+
proxy_temp_path /home/user/nginx/tmp/proxy;
|
17 |
+
fastcgi_temp_path /home/user/nginx/tmp/fastcgi;
|
18 |
+
uwsgi_temp_path /home/user/nginx/tmp/uwsgi;
|
19 |
+
scgi_temp_path /home/user/nginx/tmp/scgi;
|
20 |
+
|
21 |
+
access_log /home/user/nginx/access.log;
|
22 |
+
|
23 |
+
# Hide nginx version
|
24 |
+
server_tokens off;
|
25 |
+
|
26 |
+
sendfile on;
|
27 |
+
keepalive_timeout 65;
|
28 |
+
|
29 |
+
# The main server block
|
30 |
+
server {
|
31 |
+
listen 8080 default_server;
|
32 |
+
server_name _;
|
33 |
+
|
34 |
+
# Serve the Unity WebGL build from /unity at the container root
|
35 |
root /unity;
|
36 |
index index.html;
|
|
|
|
|
37 |
|
38 |
+
# Proxy /api/* to FastAPI running on localhost:3000
|
39 |
+
location /api/ {
|
40 |
+
proxy_pass http://127.0.0.1:3000/;
|
41 |
+
proxy_http_version 1.1;
|
42 |
|
43 |
+
# For WebSocket/streaming support (if your FastAPI endpoints use it)
|
44 |
+
proxy_set_header Upgrade $http_upgrade;
|
45 |
+
proxy_set_header Connection "upgrade";
|
46 |
+
|
47 |
+
# Forward original Host header, useful for logs or domain-specific logic
|
48 |
+
proxy_set_header Host $host;
|
49 |
}
|
50 |
|
51 |
+
# All other files are served from the Unity build
|
52 |
+
# If file is not found, try returning index.html (useful for single-page apps)
|
53 |
+
location / {
|
54 |
+
try_files $uri $uri/ /index.html;
|
55 |
+
}
|
56 |
}
|
57 |
}
|
supervisord.conf
CHANGED
@@ -5,8 +5,7 @@ logfile_maxbytes=0
|
|
5 |
pidfile=/tmp/supervisord.pid
|
6 |
|
7 |
[program:nginx]
|
8 |
-
command
|
9 |
-
directory=/unity
|
10 |
autostart=true
|
11 |
autorestart=true
|
12 |
stdout_logfile=/dev/stdout
|
|
|
5 |
pidfile=/tmp/supervisord.pid
|
6 |
|
7 |
[program:nginx]
|
8 |
+
command=/usr/sbin/nginx -g 'daemon off;'
|
|
|
9 |
autostart=true
|
10 |
autorestart=true
|
11 |
stdout_logfile=/dev/stdout
|