Spaces:
Running
Running
Fix Dev Mode build: install git (+wget/openssh) in image
Browse files- Dockerfile +33 -0
Dockerfile
CHANGED
|
@@ -4,9 +4,42 @@ FROM ghcr.io/tashfeenahmed/freellmapi:latest
|
|
| 4 |
# The base image already runs as `node` (uid 1000) via its entrypoint,
|
| 5 |
# so this stays compatible. We only remap port + DB path and fix perms.
|
| 6 |
USER root
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
RUN mkdir -p /data && chmod 777 /data \
|
| 8 |
&& mkdir -p /app/server/data && chown -R node:node /app/server/data || true
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
ENV NODE_ENV=production \
|
| 11 |
PORT=7860 \
|
| 12 |
HOST=:: \
|
|
|
|
| 4 |
# The base image already runs as `node` (uid 1000) via its entrypoint,
|
| 5 |
# so this stays compatible. We only remap port + DB path and fix perms.
|
| 6 |
USER root
|
| 7 |
+
# ---------------------------------------------------------------------------
|
| 8 |
+
# Dev Mode support — REQUIRED while Space Settings -> Dev Mode is ON.
|
| 9 |
+
#
|
| 10 |
+
# When Dev Mode is enabled, Hugging Face appends extra build stages to this
|
| 11 |
+
# file and runs these steps INSIDE THIS IMAGE (stage-2 = the image below):
|
| 12 |
+
# RUN git config --global user.name "<owner>"
|
| 13 |
+
# RUN git config --global user.email "<owner>@users.noreply.huggingface.co"
|
| 14 |
+
# RUN mkdir -p /home/user && ( [ -e /home/user/app ] || ln -s /app/ /home/user/app )
|
| 15 |
+
# RUN ln -s /dev-mode/init-process /tmp/init-process
|
| 16 |
+
# LINK COPY --link --from=vscode /opt/openvscode-server /opt/openvscode-server
|
| 17 |
+
#
|
| 18 |
+
# The upstream runtime stage is node:20-bookworm-slim, which ships WITHOUT git.
|
| 19 |
+
# The injected `git config` step therefore died with:
|
| 20 |
+
# /bin/sh: 1: git: not found -> exit code 127
|
| 21 |
+
# which failed the whole Space build (BUILD_ERROR / "Job failed with exit code: 1").
|
| 22 |
+
#
|
| 23 |
+
# Installing git here fixes Dev Mode. wget is what the injected OpenVSCode
|
| 24 |
+
# Server stage uses; openssh-client/ca-certificates make the web IDE and SSH
|
| 25 |
+
# usable. Cached layer, harmless when Dev Mode is OFF.
|
| 26 |
+
# ---------------------------------------------------------------------------
|
| 27 |
+
RUN apt-get update \
|
| 28 |
+
&& apt-get install -y --no-install-recommends \
|
| 29 |
+
git \
|
| 30 |
+
ca-certificates \
|
| 31 |
+
openssh-client \
|
| 32 |
+
wget \
|
| 33 |
+
&& rm -rf /var/lib/apt/lists/* \
|
| 34 |
+
&& git --version
|
| 35 |
+
|
| 36 |
RUN mkdir -p /data && chmod 777 /data \
|
| 37 |
&& mkdir -p /app/server/data && chown -R node:node /app/server/data || true
|
| 38 |
|
| 39 |
+
# Dev Mode opens a terminal with a non-root HOME; the injected build step also
|
| 40 |
+
# symlinks the app there (`ln -s /app /home/user/app`). Pre-create it writable.
|
| 41 |
+
RUN mkdir -p /home/user && chmod 777 /home/user
|
| 42 |
+
|
| 43 |
ENV NODE_ENV=production \
|
| 44 |
PORT=7860 \
|
| 45 |
HOST=:: \
|