Spaces:
Running
Running
| FROM python:3.11-slim | |
| # Install system tools + Node.js 20.x (npm) + Bun. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| supervisor \ | |
| git \ | |
| curl \ | |
| build-essential \ | |
| ca-certificates \ | |
| bash \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Node.js 20.x (provides node + npm + npx). | |
| RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ | |
| && apt-get install -y --no-install-recommends nodejs \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Bun — fast JS/TS runtime, package manager, bundler. | |
| # Installs to ~/.bun; we put it in /usr/local so all users get it. | |
| RUN npm install -g bun | |
| # Create the non-root user (HF convention: uid 1000) and app dirs. | |
| RUN useradd -m -u 1000 user \ | |
| && mkdir -p /data /home/user/.jupyter /home/user/app \ | |
| && chown -R user:user /data /home/user | |
| # Python deps. | |
| COPY requirements.txt /tmp/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade pip \ | |
| && pip install --no-cache-dir -r /tmp/requirements.txt \ | |
| && rm /tmp/requirements.txt | |
| # Config + app files. | |
| COPY jupyter_lab_config.py /home/user/.jupyter/jupyter_lab_config.py | |
| COPY proxy.py start.sh login.html /home/user/app/ | |
| RUN chmod +x /home/user/app/start.sh \ | |
| && chown -R user:user /home/user | |
| # JupyterLab frontend override: always show hidden files in file browser. | |
| RUN mkdir -p /root/.jupyter/lab/user-settings \ | |
| && echo '{"@jupyterlab/filebrowser-extension:plugin":{"showHiddenFiles":true}}' \ | |
| > /root/.jupyter/lab/user-settings/overrides.json | |
| # Supervisor config (runs proxy on port 7860 + JupyterLab on localhost:8888). | |
| COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
| EXPOSE 7860 | |
| ENV NPM_CONFIG_PREFIX="/data/.npm-global" | |
| # 2. Daftarkan folder bin global tersebut (dan folder lokal sebelumnya) ke dalam PATH | |
| ENV PATH="/data/.npm-global/bin:/data/node_modules/.bin:${PATH}" | |
| # supervisord is the entrypoint (root, drops privileges per-program). | |
| CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] | |