update
Browse filesFiles changed (2)
- anycoder_app/prompts.py+13-29
- anycoder_app/ui.py+8-15
295 unmodified lines296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349295 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"]- If using a different port, make sure to set app_port in the README.md YAML frontmatterExample 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"]```295 unmodified lines296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333295 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 /appRUN apt-get update && 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"]"""1114 unmodified lines1115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381114 unmodified linesif 'Dockerfile' not in files:files['Dockerfile'] = """FROM node:18-slimWORKDIR /appRUN apt-get update && 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"]"""
anycoder_app/prompts.py+13-29
anycoder_app/ui.py+8-15