Download Dockerfile from Rsnarsna/mindmap: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/spaces/Rsnarsna/mindmap/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Rsnarsna/mindmap/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Rsnarsna/mindmap/resolve/main/Dockerfile
1.78 kB
| # Use official Python 3.10 image as base | |
| FROM python:3.10-slim | |
| # Install Node.js (for React build) and other dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y curl build-essential git && \ | |
| curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \ | |
| apt-get install -y nodejs && \ | |
| apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Set up a new user named "user" with user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| # Set environment variables | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Copy requirements first for better caching | |
| COPY --chown=user requirements.txt $HOME/app/requirements.txt | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the code | |
| COPY --chown=user . $HOME/app | |
| # Build the React frontend | |
| WORKDIR $HOME/app/frontend | |
| RUN npm install --legacy-peer-deps && npm run build | |
| # Move build to a static directory for Flask to serve | |
| RUN mkdir -p $HOME/app/static && \ | |
| cp -r build/* $HOME/app/static/ | |
| # Switch back to backend directory | |
| WORKDIR $HOME/app | |
| # Install supervisor | |
| RUN apt-get update && apt-get install -y supervisor | |
| # Create supervisor config directory | |
| RUN mkdir -p /etc/supervisor/conf.d | |
| # Copy supervisor config | |
| COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
| # Switch to the "user" user | |
| USER user | |
| # Expose both ports (adjust as needed) | |
| EXPOSE 7860 3000 | |
| # Set environment for React dev server | |
| ENV HOST=0.0.0.0 | |
| ENV PORT=3000 | |
| # Start supervisor (which starts both Flask and React) | |
| CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] | |