Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e713184

Browse files
nhooyrkylecarbs
authored andcommitted
Add Dockerfile and some cleanup (#57)
1 parent 2702d20 commit e713184

File tree

5 files changed

+57
-5
lines changed

5 files changed

+57
-5
lines changed

‎.dockerignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Dockerfile

‎Dockerfile‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:8.15.0
2+
3+
# Install VS Code's deps. These are the only two it seems we need.
4+
RUN apt-get update
5+
RUN apt-get install -y libxkbfile-dev libsecret-1-dev
6+
7+
# Ensure latest yarn.
8+
RUN npm install -g yarn
9+
10+
# In the future, we can use https://github.com/yarnpkg/rfcs/pull/53 to make it use the node_modules
11+
# directly which should be faster.
12+
WORKDIR /src
13+
COPY . .
14+
RUN yarn
15+
RUN yarn task build:server:binary
16+
17+
# We deploy with ubuntu so that devs have a familiar environemnt.
18+
FROM ubuntu:18.10
19+
RUN apt-get update
20+
RUN apt-get install -y openssl
21+
RUN apt-get install -y net-tools
22+
WORKDIR /root/project
23+
COPY --from=0 /src/packages/server/cli-linux /usr/local/bin/code-server
24+
EXPOSE 8443
25+
# Unfortunately `.` does not work with code-server.
26+
CMD code-server $PWD

‎README.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a remote server, accessible through the browser.
99

10+
Try it out:
11+
```bash
12+
docker run -p localhost:8443:8443 -v "${PWD}:/root/project" codercom/code-server code-server --allow-http --no-auth
13+
```
14+
1015
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
1116
- If you have a Windows or Mac workstation, more easily develop for Linux.
1217
- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
@@ -18,9 +23,15 @@
1823

1924
## Getting Started
2025

26+
### Hosted
27+
2128
[Try `code-server` now](https://coder.com/signup) for free at coder.com.
2229

23-
**OR**
30+
### Docker
31+
32+
See docker oneliner mentioned above. Dockerfile is at [/Dockerfile](/Dockerfile).
33+
34+
### Binaries
2435

2536
1. [Download a binary](https://github.com/codercom/code-server/releases) (Linux and OSX supported. Windows coming soon)
2637
2. Start the binary with the project directory as the first argument

‎packages/runner/src/runner.ts‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as cp from "child_process";
2-
import {logger, Logger, field, time} from "@coder/logger";
2+
import {field, Logger, logger, time} from "@coder/logger";
33

44
export interface CommandResult {
55
readonly exitCode: number;
@@ -9,7 +9,9 @@ export interface CommandResult {
99

1010
const execute = (command: string, args: string[] = [], options: cp.SpawnOptions, logger: Logger): Promise<CommandResult> => {
1111
let resolve: (result: CommandResult) => void;
12-
const prom = new Promise<CommandResult>(res => resolve = res);
12+
const prom = new Promise<CommandResult>((res): void => {
13+
resolve = res;
14+
});
1315

1416
const stdout: string[] = [];
1517
const stderr: string[] = [];
@@ -45,6 +47,7 @@ export type TaskFunction = (runner: Runner, ...args: any[]) => void | Promise<vo
4547

4648
export interface Runner {
4749
cwd: string;
50+
4851
execute(command: string, args?: string[], env?: object): Promise<CommandResult>;
4952
}
5053

@@ -91,10 +94,22 @@ export const run = (name: string = process.argv[2]): void | Promise<void> => {
9194
cwd = path;
9295
},
9396
execute(command: string, args: string[] = [], env?: object): Promise<CommandResult> {
94-
return execute(command, args, {
97+
constprom= execute(command, args, {
9598
cwd,
9699
env: env as NodeJS.ProcessEnv,
97100
}, log);
101+
102+
return prom.then((result: CommandResult) => {
103+
if (result.exitCode != 0) {
104+
log.error("failed",
105+
field("exitCode", result.exitCode),
106+
field("stdout", result.stdout),
107+
field("stderr", result.stderr)
108+
);
109+
}
110+
111+
return result;
112+
});
98113
},
99114
}, ...process.argv.slice(3));
100115

‎scripts/build.sh‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
22
set -e
33

4-
npm install -g cross-env
54
yarn task build:server:binary

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /