Skip to content

Commit 3f1be8c

Browse files
committed
#2512 issue to add code-server to a template into IDE docs
1 parent 8d6faa3 commit 3f1be8c

File tree

2 files changed

+54
-9
lines changed

2 files changed

+54
-9
lines changed

docs/ides.md

+54-9
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,65 @@ Code, connected to your Coder workspace for compute, etc.
5757
1. In VS Code's left-hand nav bar, click **Remote Explorer** and right-click on
5858
a workspace to connect.
5959

60-
## VS Code in the browser
60+
## VS Code in the browser (code-server)
6161

62-
> You must have Docker Desktop running for this template to work.
62+
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.
6363

64-
Coder offers a [sample template that includes
65-
code-server](../examples/templates/docker-code-server/README.md).
64+
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.
6665

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

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

71-
```console
72-
coder server --dev
73-
```
72+
```console
73+
FROM codercom/enterprise-base:ubuntu
74+
75+
USER root
76+
77+
# Install code-server
78+
RUN curl -fsSL https://code-server.dev/install.sh | sh
79+
80+
USER coder
81+
```
82+
83+
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.
84+
85+
```console
86+
resource "coder_agent" "coder" {
87+
os = "linux"
88+
arch = "amd64"
89+
startup_script = <<EOT
90+
#!/bin/bash
91+
92+
# install code-server
93+
curl -fsSL https://code-server.dev/install.sh | sh
94+
95+
# start code-server
96+
code-server --auth none --port 13337
97+
98+
EOT
99+
}
100+
101+
# code-server
102+
resource "coder_app" "code-server" {
103+
agent_id = coder_agent.coder.id
104+
name = "code-server"
105+
icon = "https://cdn.icon-icons.com/icons2/2107/PNG/512/file_type_vscode_icon_130084.png"
106+
url = "http://localhost:13337?folder=/home/coder"
107+
relative_path = true
108+
}
109+
```
110+
111+
Coder also provides an example template that uses the `code-server` container image with `code-server` already installed.
112+
113+
> You must have Docker Desktop or a Docker engine running for this template to work.
114+
115+
Coder offers a [sample template that includes
116+
code-server](../examples/templates/docker-code-server/README.md).
117+
118+
To use, start Coder the follow these steps:
74119

75120
1. Open a new terminal and run:
76121

docs/images/code-server-in-ui.png

159 KB
Loading

0 commit comments

Comments
 (0)