Spaces:
Running
Running
update
Browse files- anycoder_app/prompts.py +17 -17
- anycoder_app/ui.py +9 -8
anycoder_app/prompts.py
CHANGED
|
@@ -327,18 +327,17 @@ module.exports = nextConfig
|
|
| 327 |
|
| 328 |
Dockerfile Requirements (CRITICAL for HuggingFace Spaces):
|
| 329 |
- Use Node.js 18+ base image (e.g., FROM node:18-slim)
|
| 330 |
-
-
|
| 331 |
```
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
WORKDIR $HOME/app
|
| 337 |
```
|
| 338 |
-
- ALWAYS use --chown=
|
| 339 |
```
|
| 340 |
-
COPY --chown=
|
| 341 |
-
COPY --chown=
|
| 342 |
```
|
| 343 |
- Install dependencies: RUN npm install
|
| 344 |
- Build the app: RUN npm run build
|
|
@@ -349,23 +348,24 @@ Example Dockerfile structure:
|
|
| 349 |
```dockerfile
|
| 350 |
FROM node:18-slim
|
| 351 |
|
| 352 |
-
#
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
|
|
|
| 357 |
|
| 358 |
# Set working directory
|
| 359 |
-
WORKDIR
|
| 360 |
|
| 361 |
# Copy package files with proper ownership
|
| 362 |
-
COPY --chown=
|
| 363 |
|
| 364 |
# Install dependencies
|
| 365 |
RUN npm install
|
| 366 |
|
| 367 |
# Copy rest of the application with proper ownership
|
| 368 |
-
COPY --chown=
|
| 369 |
|
| 370 |
# Build the Next.js app
|
| 371 |
RUN npm run build
|
|
|
|
| 327 |
|
| 328 |
Dockerfile Requirements (CRITICAL for HuggingFace Spaces):
|
| 329 |
- Use Node.js 18+ base image (e.g., FROM node:18-slim)
|
| 330 |
+
- Use the existing 'node' user (UID 1000 already exists in node base images):
|
| 331 |
```
|
| 332 |
+
USER node
|
| 333 |
+
ENV HOME=/home/node \\
|
| 334 |
+
PATH=/home/node/.local/bin:$PATH
|
| 335 |
+
WORKDIR /home/node/app
|
|
|
|
| 336 |
```
|
| 337 |
+
- ALWAYS use --chown=node:node with COPY and ADD commands:
|
| 338 |
```
|
| 339 |
+
COPY --chown=node:node package*.json ./
|
| 340 |
+
COPY --chown=node:node . .
|
| 341 |
```
|
| 342 |
- Install dependencies: RUN npm install
|
| 343 |
- Build the app: RUN npm run build
|
|
|
|
| 348 |
```dockerfile
|
| 349 |
FROM node:18-slim
|
| 350 |
|
| 351 |
+
# Use the existing node user (UID 1000)
|
| 352 |
+
USER node
|
| 353 |
+
|
| 354 |
+
# Set environment variables
|
| 355 |
+
ENV HOME=/home/node \\
|
| 356 |
+
PATH=/home/node/.local/bin:$PATH
|
| 357 |
|
| 358 |
# Set working directory
|
| 359 |
+
WORKDIR /home/node/app
|
| 360 |
|
| 361 |
# Copy package files with proper ownership
|
| 362 |
+
COPY --chown=node:node package*.json ./
|
| 363 |
|
| 364 |
# Install dependencies
|
| 365 |
RUN npm install
|
| 366 |
|
| 367 |
# Copy rest of the application with proper ownership
|
| 368 |
+
COPY --chown=node:node . .
|
| 369 |
|
| 370 |
# Build the Next.js app
|
| 371 |
RUN npm run build
|
anycoder_app/ui.py
CHANGED
|
@@ -1115,23 +1115,24 @@ with gr.Blocks(
|
|
| 1115 |
if 'Dockerfile' not in files:
|
| 1116 |
files['Dockerfile'] = """FROM node:18-slim
|
| 1117 |
|
| 1118 |
-
#
|
| 1119 |
-
|
| 1120 |
-
|
| 1121 |
-
|
| 1122 |
-
|
|
|
|
| 1123 |
|
| 1124 |
# Set working directory
|
| 1125 |
-
WORKDIR
|
| 1126 |
|
| 1127 |
# Copy package files with proper ownership
|
| 1128 |
-
COPY --chown=
|
| 1129 |
|
| 1130 |
# Install dependencies
|
| 1131 |
RUN npm install
|
| 1132 |
|
| 1133 |
# Copy rest of the application with proper ownership
|
| 1134 |
-
COPY --chown=
|
| 1135 |
|
| 1136 |
# Build the Next.js app
|
| 1137 |
RUN npm run build
|
|
|
|
| 1115 |
if 'Dockerfile' not in files:
|
| 1116 |
files['Dockerfile'] = """FROM node:18-slim
|
| 1117 |
|
| 1118 |
+
# Use the existing node user (UID 1000)
|
| 1119 |
+
USER node
|
| 1120 |
+
|
| 1121 |
+
# Set environment variables
|
| 1122 |
+
ENV HOME=/home/node \\
|
| 1123 |
+
PATH=/home/node/.local/bin:$PATH
|
| 1124 |
|
| 1125 |
# Set working directory
|
| 1126 |
+
WORKDIR /home/node/app
|
| 1127 |
|
| 1128 |
# Copy package files with proper ownership
|
| 1129 |
+
COPY --chown=node:node package*.json ./
|
| 1130 |
|
| 1131 |
# Install dependencies
|
| 1132 |
RUN npm install
|
| 1133 |
|
| 1134 |
# Copy rest of the application with proper ownership
|
| 1135 |
+
COPY --chown=node:node . .
|
| 1136 |
|
| 1137 |
# Build the Next.js app
|
| 1138 |
RUN npm run build
|