update
Browse filesFiles changed (2)
- anycoder_app/prompts.py+13-29
- anycoder_app/ui.py+8-15
295 unmodified lines296297298299300301302303304305306307308309310311299300301302303304305306307316308309310311312322323324325326313314328329315316317318331332319320334321322337338323324340325326343327328346329330331332333295 unmodified lines
Dockerfile 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 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 . . ```- 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"]- If using a different port, make sure to set app_port in the README.md YAML frontmatter
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:$PATHWORKDIR /app
# Set working directoryWORKDIR $HOME/appRUN apt-get update && apt-get install -y \ curl \ && rm -rf /var/lib/apt/lists/*
# Copy package files with proper ownershipCOPY --chown=user package*.json ./COPY package*.json ./
# Install dependenciesRUN npm install
# Copy rest of the application with proper ownershipCOPY --chown=user . .COPY . .
# Build the Next.js appRUN npm run build
# Expose port 7860EXPOSE 7860
# Start the application on port 7860HEALTHCHECK CMD curl --fail http://localhost:7860/ || exit 1
CMD ["npm", "start", "--", "-p", "7860"]```
1114 unmodified lines1115111611171118111911201121112211181119112411251120112111221123112711281124112511301126112711331134112811291136113011311139113211331142113411351136113711381114 unmodified lines if '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:$PATHWORKDIR /app
# Set working directoryWORKDIR $HOME/appRUN apt-get update && apt-get install -y \\ curl \\ && rm -rf /var/lib/apt/lists/*
# Copy package files with proper ownershipCOPY --chown=user package*.json ./COPY package*.json ./
# Install dependenciesRUN npm install
# Copy rest of the application with proper ownershipCOPY --chown=user . .COPY . .
# Build the Next.js appRUN npm run build
# Expose port 7860EXPOSE 7860
# Start the application on port 7860HEALTHCHECK CMD curl --fail http://localhost:7860/ || exit 1
CMD ["npm", "start", "--", "-p", "7860"]""" anycoder_app/prompts.py+13-29
anycoder_app/ui.py+8-15