Spaces:
Running
Running
File size: 3,155 Bytes
22b1ad1 5968fa3 c4ea508 45d1223 705af45 c4ea508 77a2016 45d1223 e060533 45d1223 e060533 45d1223 fa56ac6 45d1223 809c9c6 06ace8d 809c9c6 06ace8d 809c9c6 06ace8d 45d1223 06ace8d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
---
title: README
emoji: 👀
colorFrom: blue
colorTo: red
sdk: static
pinned: false
---
<div style="background-color: rgba(255, 255, 255, 0.5); color: rgba(0, 0, 0, 0.87); border: 1px solid rgba(0, 0, 0, 0.5); border-radius: 8px; padding: 0.5rem 1rem;">
<span style="font-weight: 600;">Spaces Dev Mode is currently in beta.</span> It's available for <a target="_blank" href="https://huggingface.co/subscribe/pro" style="color: inherit;">PRO subscribers</a>.
</div>
<div style="background-color: rgba(255, 255, 255, 0.5); color: rgba(0, 0, 0, 0.87); border: 1px solid rgba(0, 0, 0, 0.5); border-radius: 8px; padding: 0.5rem 1rem; margin-top: 10px; margin-bottom: 30px;">
<span style="font-weight: 600;">Please share your feedback about Spaces Dev Mode</span> in the <a target="_blank" href="https://huggingface.co/spaces/dev-mode-explorers/README/discussions" style="color: inherit;">Community tab</a>.
</div>
# Spaces Dev Mode (feature preview)
If Dev mode is enabled on your Space, you can connect to it using SSH or VS Code.
You can make changes to your application code, run some debug tools, ...
<img src="https://cdn-uploads.huggingface.co/production/uploads/5f17f0a0925b9863e28ad517/wSfCELm8WoY_EFhj8l1MM.png" style="max-width: 500px;">
Changes will be reflected in 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 developing locally.
## How to enable the dev mode
Go to your Space's settings and click on "Enable dev mode".
![image/png](https://cdn-uploads.huggingface.co/production/uploads/5fcfb7c407408029ba3577e2/QvLqvKxEzq8v0cpxQQ5An.png)
## 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.
1. The following packages must be installed:
- `bash` (required to establish SSH connections)
- `curl`, `wget` and `procps` (required by the VS Code server process)
- `git` and `git-lfs` to be able to commit and push changes from your dev mode environment
2. Your application code must be located in the `/app` folder for the dev mode daemon to be able to detect changes.
3. The `/app` folder must be owned by the user with uid `1000` to allow you to make changes to the code.
4. The Dockerfile must contain a `CMD` instruction for startup. Checkout [Docker's documentation](https://docs.docker.com/reference/dockerfile/#cmd) about the `CMD` 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`.
```Dockerfile
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"]
```
|