Spaces:
Running
title: README
emoji: π
colorFrom: blue
colorTo: red
sdk: static
pinned: false
Spaces Dev Mode (feature preview)
Members of this organization have early access to the new "Dev Mode" feature on Spaces.
About Dev Mode
When the "Dev mode" is enabled on Space, you can connect to it using SSH or VS Code.
You can make changes to your application code, run some debug tools, ...
Changes reflect to your Space after you hit the "Refresh" button.
When you are done, you can persist your changes using git
as you would normally do when developping locally.
How to enable the dev mode
Go to your Space's settings and click on "Enable dev mode".
Limitations
The dev mode is currently not available for static Spaces.
Docker Spaces
Dev mode is supported for Docker Spaces. However, your Space needs to comply with the following rules for the Dev mode to work properly.
- The following packages must be installed:
bash
(required to establish SSH connections)curl
,wget
andprocps
(required by the VS Code server process)git
andgit-lfs
to be able to commit and push changes from your dev mode environment
Your application code must be located in the
/app
folder for the dev mode daemon to be able to detect changes.The
/app
folder must be owned by the user with uid1000
to allow you to make changes to the code.The Dockerfile must contain a
CMD
instruction for startup. Checkout Docker's documentation about theCMD
instruction for more details.
Example of a compatible Dockerfile
This is an example of a Dockerfile compatible with Spaces dev mode.
It installs the required packages with apt-get
, along with a couple more for developer convenience (namely: top
, vim
and nano
).
It then starts a NodeJS application from /app
.
FROM node:19-slim
RUN RUN apt-get update && \
apt-get install -y \
bash \
git git-lfs \
wget curl procps \
htop vim nano && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --link --chown=1000 ./ /app
RUN npm ci
CMD ["node", "index.mjs"]