Avitesh Murmu commited on
Commit
c8d4f54
Β·
1 Parent(s): 8aef2fd

Robust lowercase fix and CDN fallback

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -12
Dockerfile CHANGED
@@ -1,6 +1,5 @@
1
  FROM python:3.11-slim
2
 
3
- # 1. Install system dependencies (unzip + findutils)
4
  USER root
5
  RUN apt-get update && apt-get install -y \
6
  unzip \
@@ -8,31 +7,42 @@ RUN apt-get update && apt-get install -y \
8
 
9
  WORKDIR /app
10
 
11
- # 2. Add Hugging Face User Configuration
12
  RUN useradd -m -u 1000 user
13
  USER user
14
  ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH
16
  WORKDIR $HOME/app
17
 
18
- # 3. Install Python dependencies
19
  COPY --chown=user requirements.txt ./requirements.txt
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
- # 4. Copy your project files
23
  COPY --chown=user . .
24
 
25
- # 5. UNZIP and FIX CASE SENSITIVITY
26
- # This unzips, then finds every file/folder and renames it to lowercase
27
  RUN if [ -f "vcsky.zip" ]; then \
28
- unzip vcsky.zip -d vcsky && \
 
29
  rm vcsky.zip && \
30
- find vcsky -exec sh -c 'mv "$1" "$(echo "$1" | tr [:upper:] [:lower:])"' -- {} + 2>/dev/null || true; \
 
 
 
 
 
 
 
 
 
 
31
  fi
32
 
33
- # 6. Hugging Face Spaces MUST listen on port 7860
34
  EXPOSE 7860
35
 
36
- # 7. Start the app
37
- # Use --vcsky_cache instead of --vcsky_local as a safety fallback
38
- CMD ["python", "server.py", "--port", "7860", "--vcbr_local", "--vcsky_local", "--custom_saves"]
 
 
 
1
  FROM python:3.11-slim
2
 
 
3
  USER root
4
  RUN apt-get update && apt-get install -y \
5
  unzip \
 
7
 
8
  WORKDIR /app
9
 
10
+ # Add Hugging Face User
11
  RUN useradd -m -u 1000 user
12
  USER user
13
  ENV HOME=/home/user \
14
  PATH=/home/user/.local/bin:$PATH
15
  WORKDIR $HOME/app
16
 
17
+ # Install dependencies
18
  COPY --chown=user requirements.txt ./requirements.txt
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy everything
22
  COPY --chown=user . .
23
 
24
+ # UNZIP and DEBUG structure
 
25
  RUN if [ -f "vcsky.zip" ]; then \
26
+ # Unzip into the current directory (relying on the zip containing the 'vcsky' folder)
27
+ unzip vcsky.zip && \
28
  rm vcsky.zip && \
29
+ # Robust lowercase fix: Rename files first, then directories
30
+ find vcsky -depth -exec sh -c ' \
31
+ base=$(basename "$1"); \
32
+ dir=$(dirname "$1"); \
33
+ new=$(echo "$base" | tr "[:upper:]" "[:lower:]"); \
34
+ if [ "$base" != "$new" ]; then \
35
+ mv "$1" "$dir/$new"; \
36
+ fi' -- {} +; \
37
+ # DEBUG: Print the first 20 files to verify location in logs
38
+ echo "--- VERIFYING FILE STRUCTURE ---" && \
39
+ find vcsky -maxdepth 3; \
40
  fi
41
 
 
42
  EXPOSE 7860
43
 
44
+ # CMD: Change to --vcsky_cache.
45
+ # NOTE: This does NOT delete your local files.
46
+ # It just means if a file is MISSING or has a WRONG NAME, the game won't crash;
47
+ # it will just download that one specific file from the CDN.
48
+ CMD ["python", "server.py", "--port", "7860", "--vcbr_local", "--vcsky_cache", "--custom_saves"]