mirror of https://github.com/coder/code-server.git
Add Dockerfile and some cleanup (#57)
This commit is contained in:
parent
ac56fcaafc
commit
17267bd801
|
@ -0,0 +1 @@
|
||||||
|
Dockerfile
|
|
@ -0,0 +1,26 @@
|
||||||
|
FROM node:8.15.0
|
||||||
|
|
||||||
|
# Install VS Code's deps. These are the only two it seems we need.
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y libxkbfile-dev libsecret-1-dev
|
||||||
|
|
||||||
|
# Ensure latest yarn.
|
||||||
|
RUN npm install -g yarn
|
||||||
|
|
||||||
|
# In the future, we can use https://github.com/yarnpkg/rfcs/pull/53 to make it use the node_modules
|
||||||
|
# directly which should be faster.
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
RUN yarn
|
||||||
|
RUN yarn task build:server:binary
|
||||||
|
|
||||||
|
# We deploy with ubuntu so that devs have a familiar environemnt.
|
||||||
|
FROM ubuntu:18.10
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get install -y openssl
|
||||||
|
RUN apt-get install -y net-tools
|
||||||
|
WORKDIR /root/project
|
||||||
|
COPY --from=0 /src/packages/server/cli-linux /usr/local/bin/code-server
|
||||||
|
EXPOSE 8443
|
||||||
|
# Unfortunately `.` does not work with code-server.
|
||||||
|
CMD code-server $PWD
|
13
README.md
13
README.md
|
@ -7,6 +7,11 @@
|
||||||
|
|
||||||
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a remote server, accessible through the browser.
|
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a remote server, accessible through the browser.
|
||||||
|
|
||||||
|
Try it out:
|
||||||
|
```bash
|
||||||
|
docker run -p localhost:8443:8443 -v "${PWD}:/root/project" codercom/code-server code-server --allow-http --no-auth
|
||||||
|
```
|
||||||
|
|
||||||
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
|
- Code on your Chromebook, tablet, and laptop with a consistent dev environment.
|
||||||
- If you have a Windows or Mac workstation, more easily develop for Linux.
|
- If you have a Windows or Mac workstation, more easily develop for Linux.
|
||||||
- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
|
- Take advantage of large cloud servers to speed up tests, compilations, downloads, and more.
|
||||||
|
@ -18,9 +23,15 @@
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
### Hosted
|
||||||
|
|
||||||
[Try `code-server` now](https://coder.com/signup) for free at coder.com.
|
[Try `code-server` now](https://coder.com/signup) for free at coder.com.
|
||||||
|
|
||||||
**OR**
|
### Docker
|
||||||
|
|
||||||
|
See docker oneliner mentioned above. Dockerfile is at [/Dockerfile](/Dockerfile).
|
||||||
|
|
||||||
|
### Binaries
|
||||||
|
|
||||||
1. [Download a binary](https://github.com/codercom/code-server/releases) (Linux and OSX supported. Windows coming soon)
|
1. [Download a binary](https://github.com/codercom/code-server/releases) (Linux and OSX supported. Windows coming soon)
|
||||||
2. Start the binary with the project directory as the first argument
|
2. Start the binary with the project directory as the first argument
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as cp from "child_process";
|
import * as cp from "child_process";
|
||||||
import { logger, Logger, field, time } from "@coder/logger";
|
import {field, Logger, logger, time} from "@coder/logger";
|
||||||
|
|
||||||
export interface CommandResult {
|
export interface CommandResult {
|
||||||
readonly exitCode: number;
|
readonly exitCode: number;
|
||||||
|
@ -9,7 +9,9 @@ export interface CommandResult {
|
||||||
|
|
||||||
const execute = (command: string, args: string[] = [], options: cp.SpawnOptions, logger: Logger): Promise<CommandResult> => {
|
const execute = (command: string, args: string[] = [], options: cp.SpawnOptions, logger: Logger): Promise<CommandResult> => {
|
||||||
let resolve: (result: CommandResult) => void;
|
let resolve: (result: CommandResult) => void;
|
||||||
const prom = new Promise<CommandResult>(res => resolve = res);
|
const prom = new Promise<CommandResult>((res): void => {
|
||||||
|
resolve = res;
|
||||||
|
});
|
||||||
|
|
||||||
const stdout: string[] = [];
|
const stdout: string[] = [];
|
||||||
const stderr: string[] = [];
|
const stderr: string[] = [];
|
||||||
|
@ -45,6 +47,7 @@ export type TaskFunction = (runner: Runner, ...args: any[]) => void | Promise<vo
|
||||||
|
|
||||||
export interface Runner {
|
export interface Runner {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
|
|
||||||
execute(command: string, args?: string[], env?: object): Promise<CommandResult>;
|
execute(command: string, args?: string[], env?: object): Promise<CommandResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,10 +94,22 @@ export const run = (name: string = process.argv[2]): void | Promise<void> => {
|
||||||
cwd = path;
|
cwd = path;
|
||||||
},
|
},
|
||||||
execute(command: string, args: string[] = [], env?: object): Promise<CommandResult> {
|
execute(command: string, args: string[] = [], env?: object): Promise<CommandResult> {
|
||||||
return execute(command, args, {
|
const prom = execute(command, args, {
|
||||||
cwd,
|
cwd,
|
||||||
env: env as NodeJS.ProcessEnv,
|
env: env as NodeJS.ProcessEnv,
|
||||||
}, log);
|
}, log);
|
||||||
|
|
||||||
|
return prom.then((result: CommandResult) => {
|
||||||
|
if (result.exitCode != 0) {
|
||||||
|
log.error("failed",
|
||||||
|
field("exitCode", result.exitCode),
|
||||||
|
field("stdout", result.stdout),
|
||||||
|
field("stderr", result.stderr)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
}, ...process.argv.slice(3));
|
}, ...process.argv.slice(3));
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
npm install -g cross-env
|
|
||||||
yarn task build:server:binary
|
yarn task build:server:binary
|
||||||
|
|
Loading…
Reference in New Issue