Skip to content

#2512 issue to add code-server to a template into IDE docs #2513

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 54 additions & 9 deletions docs/ides.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,65 @@ Code, connected to your Coder workspace for compute, etc.
1. In VS Code's left-hand nav bar, click **Remote Explorer** and right-click on
a workspace to connect.

## VS Code in the browser
## VS Code in the browser (code-server)

> You must have Docker Desktop running for this template to work.
There a few ways to add `code-server` to a workspace. You can install it in the Dockerfile and subsequent container image or VM image, or install it dynamically as part of coder_agent resource in a template.

Coder offers a [sample template that includes
code-server](../examples/templates/docker-code-server/README.md).
You start `code-server` in the `coder_agent` resource of a template, and add a `coder_app` resource to define the icon and url for code-server to appear in the workspace web UI.

To use:
<p align="center">
<img src="./images/code-server-in-ui.png">
</p>

1. Start Coder:
Here is an example of installing `code-server` in a Dockerfile

```console
coder server --dev
```
```console
FROM codercom/enterprise-base:ubuntu

USER root

# Install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh

USER coder
```

Here is an example of installing `code-server` in the `coder_agent` resource of a template's `main.tf` and defining the `coder_app` resource. If you install `code-server` in the image, you can eliminate the install step below.

```console
resource "coder_agent" "coder" {
os = "linux"
arch = "amd64"
startup_script = <<EOT
#!/bin/bash

# install code-server
curl -fsSL https://code-server.dev/install.sh | sh

# start code-server
code-server --auth none --port 13337

EOT
}

# code-server
resource "coder_app" "code-server" {
agent_id = coder_agent.coder.id
name = "code-server"
icon = "https://cdn.icon-icons.com/icons2/2107/PNG/512/file_type_vscode_icon_130084.png"
url = "http://localhost:13337?folder=/home/coder"
relative_path = true
}
```

Coder also provides an example template that uses the `code-server` container image with `code-server` already installed.

> You must have Docker Desktop or a Docker engine running for this template to work.

Coder offers a [sample template that includes
code-server](../examples/templates/docker-code-server/README.md).

To use, start Coder the follow these steps:

1. Open a new terminal and run:

Expand Down
Binary file added docs/images/code-server-in-ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.