Spaces:
Running
Running
Download Dockerfile from sitcod3/freellmapi-cloud: direct link, hf CLI and curl.
- Browser
- Download file 2.49 kB
-
https://huggingface.co/spaces/sitcod3/freellmapi-cloud/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/sitcod3/freellmapi-cloud/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/sitcod3/freellmapi-cloud/resolve/main/Dockerfile
2.49 kB
| FROM ghcr.io/tashfeenahmed/freellmapi:latest | |
| # HF Spaces runs containers as UID 1000 and expects the app on port 7860. | |
| # The base image already runs as `node` (uid 1000) via its entrypoint, | |
| # so this stays compatible. We only remap port + DB path and fix perms. | |
| USER root | |
| # --------------------------------------------------------------------------- | |
| # Dev Mode support — REQUIRED while Space Settings -> Dev Mode is ON. | |
| # | |
| # When Dev Mode is enabled, Hugging Face appends extra build stages to this | |
| # file and runs these steps INSIDE THIS IMAGE (stage-2 = the image below): | |
| # RUN git config --global user.name "<owner>" | |
| # RUN git config --global user.email "<owner>@users.noreply.huggingface.co" | |
| # RUN mkdir -p /home/user && ( [ -e /home/user/app ] || ln -s /app/ /home/user/app ) | |
| # RUN ln -s /dev-mode/init-process /tmp/init-process | |
| # LINK COPY --link --from=vscode /opt/openvscode-server /opt/openvscode-server | |
| # | |
| # The upstream runtime stage is node:20-bookworm-slim, which ships WITHOUT git. | |
| # The injected `git config` step therefore died with: | |
| # /bin/sh: 1: git: not found -> exit code 127 | |
| # which failed the whole Space build (BUILD_ERROR / "Job failed with exit code: 1"). | |
| # | |
| # Installing git here fixes Dev Mode. wget is what the injected OpenVSCode | |
| # Server stage uses; openssh-client/ca-certificates make the web IDE and SSH | |
| # usable. Cached layer, harmless when Dev Mode is OFF. | |
| # --------------------------------------------------------------------------- | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends \ | |
| git \ | |
| ca-certificates \ | |
| openssh-client \ | |
| wget \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && git --version | |
| RUN mkdir -p /data && chmod 777 /data \ | |
| && mkdir -p /app/server/data && chown -R node:node /app/server/data || true | |
| # Dev Mode opens a terminal with a non-root HOME; the injected build step also | |
| # symlinks the app there (`ln -s /app /home/user/app`). Pre-create it writable. | |
| RUN mkdir -p /home/user && chmod 777 /home/user | |
| ENV NODE_ENV=production \ | |
| PORT=7860 \ | |
| HOST=:: \ | |
| FREELLMAPI_INSTALL_METHOD=docker \ | |
| FREEAPI_DB_PATH=/data/freellmapi.db | |
| EXPOSE 7860 | |
| # Keep upstream entrypoint (fixes perms, then drops to `node`). | |
| # Runs as root when possible so the entrypoint can chown /data; | |
| # HF Spaces executes containers as UID 1000 — the entrypoint detects | |
| # non-root and just execs the server directly (works since /data is 777). | |
| USER root | |
| CMD ["node", "server/dist/index.js"] | |