update react app
Browse filesFiles changed (2)
- anycoder_app/prompts.py+28-14
- anycoder_app/ui.py+15-9
326 unmodified lines327328329330331332330331332333334335336337338339340341342343334344345337346347348349350351344352353354355356357346347348349358359360361351362363364365366355367368369370371372373374375361362376377378379326 unmodified lines
Dockerfile Requirements (CRITICAL for HuggingFace Spaces):- Use Node.js 18+ base image (e.g., FROM node:18-slim)- Set working directory: WORKDIR /app- Install system dependencies (curl for healthcheck)- Copy package files: COPY package*.json ./- Set up a user with ID 1000 for proper permissions: ``` RUN useradd -m -u 1000 user USER user ENV HOME=/home/user \\ PATH=/home/user/.local/bin:$PATH WORKDIR $HOME/app ```- ALWAYS use --chown=user with COPY and ADD commands: ``` COPY --chown=user package*.json ./ COPY --chown=user . . ```- Install dependencies: RUN npm install- Copy application files: COPY . .- Build the app: RUN npm run build- Expose port 7860 (HuggingFace Spaces default): EXPOSE 7860- Add healthcheck: HEALTHCHECK CMD curl --fail http://localhost:7860/ || exit 1- Start with: CMD ["npm", "start", "--", "-p", "7860"]
Example Dockerfile structure:```dockerfileFROM node:18-slim
WORKDIR /app# Set up user with ID 1000RUN useradd -m -u 1000 userUSER userENV HOME=/home/user \\ PATH=/home/user/.local/bin:$PATH
# Install system dependenciesRUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ curl \ && rm -rf /var/lib/apt/lists/*# Set working directoryWORKDIR $HOME/app
# Copy package files with proper ownershipCOPY package*.json ./COPY --chown=user package*.json ./
# Install dependenciesRUN npm install
COPY . .# Copy rest of the application with proper ownershipCOPY --chown=user . .
# Build the Next.js appRUN npm run build
# Expose port 7860EXPOSE 7860
HEALTHCHECK CMD curl --fail http://localhost:7860/ || exit 1
# Start the application on port 7860CMD ["npm", "start", "--", "-p", "7860"]```
1114 unmodified lines11151116111711181118111911201121112211231120112111221123112411251126112711251128112911301131113211291133113411351136113711381139114011411135113611421143114411451114 unmodified lines if 'Dockerfile' not in files: files['Dockerfile'] = """FROM node:18-slim
WORKDIR /app# Set up user with ID 1000RUN useradd -m -u 1000 userUSER userENV HOME=/home/user \\ PATH=/home/user/.local/bin:$PATH
# Install system dependenciesRUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \\ curl \\ && rm -rf /var/lib/apt/lists/*# Set working directoryWORKDIR $HOME/app
# Copy package files with proper ownershipCOPY package*.json ./COPY --chown=user package*.json ./
# Install dependenciesRUN npm install
COPY . .# Copy rest of the application with proper ownershipCOPY --chown=user . .
# Build the Next.js appRUN npm run build
# Expose port 7860EXPOSE 7860
HEALTHCHECK CMD curl --fail http://localhost:7860/ || exit 1
# Start the application on port 7860CMD ["npm", "start", "--", "-p", "7860"]""" anycoder_app/prompts.py+28-14
anycoder_app/ui.py+15-9