Studio3D Deploy commited on
Commit
dc345d7
·
1 Parent(s): 04f41ce

Fix: Dockerfile explicit src/public COPY + build verification

Browse files
Files changed (4) hide show
  1. .dockerignore +3 -0
  2. Dockerfile +26 -18
  3. README.md +4 -18
  4. nginx.conf +3 -14
.dockerignore CHANGED
@@ -1,3 +1,6 @@
1
  node_modules/
2
  build/
3
  .git/
 
 
 
 
1
  node_modules/
2
  build/
3
  .git/
4
+ .gitignore
5
+ *.log
6
+ *.md
Dockerfile CHANGED
@@ -2,34 +2,42 @@ FROM node:18-alpine AS builder
2
 
3
  WORKDIR /app
4
 
5
- # Copy package files
6
- COPY package.json package-lock.json ./
7
-
8
  # Install dependencies
 
9
  RUN npm ci --legacy-peer-deps
10
 
11
- # Copy all source files
12
- COPY . .
 
 
13
 
14
- # Build the React app
 
 
 
15
  RUN npm run build
16
 
17
- # Production stage - serve with nginx
18
- FROM nginx:alpine
 
19
 
20
- # Copy built app
21
- COPY --from=builder /app/build /usr/share/nginx/html
22
 
23
- # Copy nginx config
 
 
24
  COPY nginx.conf /etc/nginx/conf.d/default.conf
25
 
26
- # Create assets and output directories (for HF persistent storage mount points)
27
- RUN mkdir -p /usr/share/nginx/html/assets \
28
- && mkdir -p /usr/share/nginx/html/outputs \
29
- && chmod 777 /usr/share/nginx/html/assets \
30
- && chmod 777 /usr/share/nginx/html/outputs
 
 
 
31
 
32
- # HF Spaces uses port 7860
33
  EXPOSE 7860
34
-
35
  CMD ["nginx", "-g", "daemon off;"]
 
2
 
3
  WORKDIR /app
4
 
 
 
 
5
  # Install dependencies
6
+ COPY package.json package-lock.json ./
7
  RUN npm ci --legacy-peer-deps
8
 
9
+ # Copy source
10
+ COPY public ./public
11
+ COPY src ./src
12
+ COPY tsconfig.json ./
13
 
14
+ # Build (warnings are ok, not errors)
15
+ ENV CI=false
16
+ ENV NODE_OPTIONS=--max_old_space_size=4096
17
+ ENV GENERATE_SOURCEMAP=false
18
  RUN npm run build
19
 
20
+ # Confirm build succeeded
21
+ RUN test -f /app/build/index.html && echo "BUILD OK" || (echo "BUILD FAILED" && exit 1)
22
+ RUN ls -lah /app/build/static/js/ | head -5
23
 
24
+ # ── Serve with nginx ──
25
+ FROM nginx:1.25-alpine
26
 
27
+ RUN rm /etc/nginx/conf.d/default.conf
28
+
29
+ COPY --from=builder /app/build /usr/share/nginx/html
30
  COPY nginx.conf /etc/nginx/conf.d/default.conf
31
 
32
+ RUN mkdir -p /usr/share/nginx/html/assets /usr/share/nginx/html/outputs \
33
+ && chmod -R 777 /usr/share/nginx/html \
34
+ && chown -R nginx:nginx /usr/share/nginx/html \
35
+ && chown -R nginx:nginx /var/cache/nginx \
36
+ && chown -R nginx:nginx /var/log/nginx \
37
+ && chown -R nginx:nginx /etc/nginx/conf.d \
38
+ && touch /var/run/nginx.pid \
39
+ && chown nginx:nginx /var/run/nginx.pid
40
 
41
+ USER nginx
42
  EXPOSE 7860
 
43
  CMD ["nginx", "-g", "daemon off;"]
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Studio3D - Three.js 3D Animation Studio
3
- emoji:
4
  colorFrom: indigo
5
  colorTo: purple
6
  sdk: docker
@@ -8,21 +8,7 @@ pinned: false
8
  license: mit
9
  app_port: 7860
10
  fullWidth: true
11
- short_description: Blender-like 3D studio import GLB, animate, render, AI debug
12
  ---
13
 
14
- # Studio3D — React Three Fiber 3D Animation Studio
15
-
16
- A full-featured, Blender-inspired 3D animation studio running entirely in the browser.
17
-
18
- ## Features
19
- - Import `.glb` / `.gltf` with embedded animations
20
- - Transform, material (PBR), texture, reflection controls
21
- - Skybox: procedural sky / HDR upload
22
- - Modelling / Rendering / Animation modes
23
- - AI Error Resolver via OpenRouter (stepfun/step-3.5-flash:free)
24
-
25
- ## Environment Secrets
26
- | Variable | Description |
27
- |---|---|
28
- | `REACT_APP_OPENROUTER_KEY` | Default OpenRouter API key |
 
1
  ---
2
+ title: Studio3D Three.js Animation Studio
3
+ emoji: 🎮
4
  colorFrom: indigo
5
  colorTo: purple
6
  sdk: docker
 
8
  license: mit
9
  app_port: 7860
10
  fullWidth: true
11
+ short_description: Blender-like 3D studio with AI debug
12
  ---
13
 
14
+ # 🎮 Studio3D
 
 
 
 
 
 
 
 
 
 
 
 
 
 
nginx.conf CHANGED
@@ -1,43 +1,32 @@
1
  server {
2
- listen 7860;
3
  server_name _;
4
  root /usr/share/nginx/html;
5
  index index.html;
6
 
7
- # Increase upload size limit for GLB/HDR files
8
  client_max_body_size 500M;
9
-
10
- # Gzip compression
11
  gzip on;
12
- gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/wasm;
13
 
14
- # Cache static assets
15
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|wasm|glb|gltf|hdr)$ {
16
  expires 1y;
17
  add_header Cache-Control "public, immutable";
18
  try_files $uri =404;
19
  }
20
 
21
- # Assets folder (uploaded GLB models)
22
  location /assets/ {
23
  alias /usr/share/nginx/html/assets/;
24
  add_header Access-Control-Allow-Origin *;
25
  autoindex on;
26
  }
27
 
28
- # Outputs folder (rendered videos)
29
  location /outputs/ {
30
  alias /usr/share/nginx/html/outputs/;
31
  add_header Access-Control-Allow-Origin *;
32
  autoindex on;
33
  }
34
 
35
- # SPA fallback - all routes serve index.html
36
  location / {
37
  try_files $uri $uri/ /index.html;
38
  }
39
-
40
- # Security headers
41
- add_header X-Frame-Options SAMEORIGIN;
42
- add_header X-Content-Type-Options nosniff;
43
  }
 
1
  server {
2
+ listen 0.0.0.0:7860;
3
  server_name _;
4
  root /usr/share/nginx/html;
5
  index index.html;
6
 
 
7
  client_max_body_size 500M;
 
 
8
  gzip on;
9
+ gzip_types text/plain text/css application/json application/javascript text/javascript;
10
 
11
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|wasm|glb|gltf|hdr|map)$ {
 
12
  expires 1y;
13
  add_header Cache-Control "public, immutable";
14
  try_files $uri =404;
15
  }
16
 
 
17
  location /assets/ {
18
  alias /usr/share/nginx/html/assets/;
19
  add_header Access-Control-Allow-Origin *;
20
  autoindex on;
21
  }
22
 
 
23
  location /outputs/ {
24
  alias /usr/share/nginx/html/outputs/;
25
  add_header Access-Control-Allow-Origin *;
26
  autoindex on;
27
  }
28
 
 
29
  location / {
30
  try_files $uri $uri/ /index.html;
31
  }
 
 
 
 
32
  }