Skip to content

Commit 84f330c

Browse files
updated docker docs
1 parent d3f3a4a commit 84f330c

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

packages/projects-docs/pages/sdk/templates.mdx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,27 +129,51 @@ If you run the template builder on **CI** you can pass the `--ci` flag. This rem
129129

130130
By default the template uses a universal image which gives you the most common tools and setup. You can configure your own environment by using docker. You can create your own `.codesandbox/Dockerfile` file to configure the environment, for example:
131131

132-
```Dockerfile
133-
FROM node:latest
134-
WORKDIR /project/workspace
132+
```shell
133+
# ---- Builder: install deps & build ----
134+
FROM node:22-alpine AS builder
135+
136+
# Install zsh (and optionally git, curl, etc.)
137+
RUN apk add --no-cache zsh git curl
138+
139+
# Enable corepack (pnpm/yarn) if you use it; safe to keep on
140+
RUN corepack enable
141+
142+
WORKDIR /workspace/project
135143
```
136144

145+
Ensure that you include `zsh` as this is our default shell.
146+
137147
<Callout type="warning">
138148
This only works from SDK version `2.3.0`. You can rely on the default devcontainer setup for older versions.
139149
</Callout>
140150

151+
### CodeSandbox Editor
152+
153+
If you want to use the CodeSandbox editor on https://codesandbox.io for debugging you will need to build from the CodeSandbox image:
154+
155+
```bash
156+
FROM ghcr.io/codesandbox/devcontainers/typescript-node:latest
157+
```
158+
159+
<Callout>
160+
You can debug Sandboxes using the CLI Dashboard `npx @codesandbox/sdk`.
161+
</Callout>
162+
141163
### Docker Compose Support
142164

143165
You can run additional services using Docker Compose by adding a `docker-compose.yml` configuration to your template:
144166

145167
```yaml
146168
services:
147169
app:
148-
image: mcr.microsoft.com/devcontainers/javascript-node:18
170+
build:
171+
context: ./.codesandbox
172+
dockerfile: Dockerfile
149173
command: sleep infinity
150174

151175
db:
152-
image: postgres:14
176+
image: postgres:16-alpine
153177
ports:
154178
- 5432:5432
155179
environment:

0 commit comments

Comments
 (0)