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