Spaces:
Running
Running
Update instructions for Docker-based Spaces
Browse files
README.md
CHANGED
@@ -46,10 +46,41 @@ The dev mode is currently not available for static Spaces.
|
|
46 |
|
47 |
### Docker Spaces
|
48 |
|
49 |
-
Dev mode is supported for Docker Spaces. However, your Space needs to comply with the following rules for the Dev mode to work properly
|
50 |
|
51 |
-
|
52 |
-
- The Dockerfile must contain a `CMD` instruction for startup.
|
53 |
|
54 |
-
|
|
|
|
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
### Docker Spaces
|
48 |
|
49 |
+
Dev mode is supported for Docker Spaces. However, your Space needs to comply with the following rules for the Dev mode to work properly.
|
50 |
|
51 |
+
1. The following packages must be installed:
|
|
|
52 |
|
53 |
+
- `bash` (required to establish SSH connections)
|
54 |
+
- `curl`, `wget` and `procps` (required by the VS Code server process)
|
55 |
+
- `git` and `git-lfs` to be able to commit and push changes from your dev mode environment
|
56 |
|
57 |
+
2. Your application code must be located in the `/app` folder for the dev mode daemon to be able to detect changes.
|
58 |
+
|
59 |
+
3. The `/app` folder must be owned by the user with uid `1000` to allow you to make changes to the code.
|
60 |
+
|
61 |
+
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.
|
62 |
+
|
63 |
+
### Example of a compatible Dockerfile
|
64 |
+
|
65 |
+
This is an example of a Dockerfile compatible with Spaces dev mode.
|
66 |
+
|
67 |
+
It installs the required packages with `apt-get`, along with a couple more for developer convenience (namely: `top`, `vim` and `nano`).
|
68 |
+
It then starts a NodeJS application from `/app`.
|
69 |
+
|
70 |
+
```Dockerfile
|
71 |
+
FROM node:19-slim
|
72 |
+
|
73 |
+
RUN RUN apt-get update && \
|
74 |
+
apt-get install -y \
|
75 |
+
bash \
|
76 |
+
git git-lfs \
|
77 |
+
wget curl procps \
|
78 |
+
htop vim nano && \
|
79 |
+
rm -rf /var/lib/apt/lists/*
|
80 |
+
|
81 |
+
WORKDIR /app
|
82 |
+
COPY --link --chown=1000 ./ /app
|
83 |
+
RUN npm ci
|
84 |
+
|
85 |
+
CMD ["node", "index.mjs"]
|
86 |
+
```
|