Skip to content

Commit 66a3234

Browse files
authored
Feature/remote container development (screepers#154)
* feat: add Dockerfile, config & recommended extenion * docs: add remote-development documentation * docs: fix README & installation to match node versions package.json definition
1 parent c89e174 commit 66a3234

File tree

8 files changed

+105
-20
lines changed

8 files changed

+105
-20
lines changed

.devcontainer/Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM node:12-alpine
2+
3+
RUN apk add --update --no-cache git ca-certificates openssl openssh
4+
RUN npm install -g rollup

.devcontainer/devcontainer.json

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.0/containers/docker-existing-dockerfile
3+
{
4+
"name": "Screeps-TypeScript-Starter",
5+
6+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
7+
"dockerFile": "Dockerfile",
8+
9+
// Set *default* container specific settings.json values on container create.
10+
"settings": {
11+
"terminal.integrated.shell.linux": null
12+
},
13+
14+
// Add the IDs of extensions you want installed when the container is created.
15+
"extensions": []
16+
17+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
18+
// "forwardPorts": [],
19+
20+
// Uncomment the next line to run commands after the container is created - for example installing curl.
21+
// "postCreateCommand": "apt-get update && apt-get install -y curl",
22+
23+
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
24+
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
25+
26+
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
27+
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
28+
29+
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
30+
// "remoteUser": "vscode"
31+
}

.vscode/extensions.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"recommendations": [
3+
"ms-vscode-remote.vscode-remote-extensionpack"
4+
]
5+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Screeps Typescript Starter is a starting point for a Screeps AI written in Types
66

77
You will need:
88

9-
- [Node.JS](https://nodejs.org/en/download) (10.x)
9+
- [Node.JS](https://nodejs.org/en/download) (10.x || 12.x)
1010
- A Package Manager ([Yarn](https://yarnpkg.com/en/docs/getting-started) or [npm](https://docs.npmjs.com/getting-started/installing-node))
1111
- Rollup CLI (Optional, install via `npm install -g rollup`)
1212

6.34 KB
Loading

docs/SUMMARY.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# Table of contents
22

3-
* [Introduction](README.md)
3+
- [Introduction](README.md)
44

55
## Getting Started
66

7-
* [Installation](getting-started/installation.md)
8-
* [Authenticating with Screeps](getting-started/authenticating.md)
9-
* [Deploying](getting-started/deploying.md)
7+
- [Installation](getting-started/installation.md)
8+
- [Authenticating with Screeps](getting-started/authenticating.md)
9+
- [Deploying](getting-started/deploying.md)
1010

1111
## In-Depth
1212

13-
* [Module bundling](in-depth/module-bundling.md)
14-
* [Deploy destinations](in-depth/deploy-destinations.md)
15-
* [TypeScript](in-depth/typescript.md)
16-
* [Prettier](in-depth/prettier.md)
17-
* [Testing](in-depth/testing.md)
18-
* [Cookbook](in-depth/cookbook/README.md)
19-
* [Environment variables](in-depth/cookbook/environment-variables.md)
20-
* [One-line PowerShell setup](in-depth/cookbook/one-line-powershell.md)
21-
* [Troubleshooting](in-depth/troubleshooting.md)
22-
* [Contributing to the docs](in-depth/contributing.md)
23-
13+
- [Module bundling](in-depth/module-bundling.md)
14+
- [Deploy destinations](in-depth/deploy-destinations.md)
15+
- [TypeScript](in-depth/typescript.md)
16+
- [Prettier](in-depth/prettier.md)
17+
- [Testing](in-depth/testing.md)
18+
- [Cookbook](in-depth/cookbook/README.md)
19+
- [Environment variables](in-depth/cookbook/environment-variables.md)
20+
- [One-line PowerShell setup](in-depth/cookbook/one-line-powershell.md)
21+
- [Remote Development](in-depth/remote-development.md)
22+
- [Troubleshooting](in-depth/troubleshooting.md)
23+
- [Contributing to the docs](in-depth/contributing.md)

docs/getting-started/installation.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
You will need:
66

7-
* [Node.JS](https://nodejs.org/en/download) \(>= 8.0.0\)
8-
* A Package Manager \([Yarn](https://yarnpkg.com/en/docs/getting-started) or [npm](https://docs.npmjs.com/getting-started/installing-node)\)
9-
* Rollup CLI \(Optional, install via `npm install -g rollup`\)
7+
- [Node.JS](https://nodejs.org/en/download) (10.x || 12.x)
8+
- A Package Manager \([Yarn](https://yarnpkg.com/en/docs/getting-started) or [npm](https://docs.npmjs.com/getting-started/installing-node)\)
9+
- Rollup CLI \(Optional, install via `npm install -g rollup`\)
1010

1111
## Installing `npm` modules
1212

@@ -21,4 +21,3 @@ yarn
2121
```
2222

2323
Once that's all done, let's [authenticate with the Screeps server](authenticating.md).
24-

docs/in-depth/remote-development.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Remote Development
2+
3+
It may be the case you don't want to install and maintain multiple versions of Node _(10, 12, 14... future releases)_ in your machine, or you don't want to install npm packages globally.
4+
5+
Keep your Screeps-TypeScript project isolated with its dependencies within a container!
6+
7+
VS Code supports remote development and allows you to use a container as a full-featured development environment. You can open a project mounted into a Docker container to edit with full code completions, code navigation, debugging, and more.
8+
9+
Refer to VS Code documentation if you want to understand more about remote development:
10+
11+
- Use a [Docker Container](https://www.docker.com/) as your [development container](https://code.visualstudio.com/docs/remote/containers#_indepth-setting-up-a-folder-to-run-in-a-container)
12+
- Switch your development environment by [connecting to a container](https://code.visualstudio.com/docs/remote/containers)
13+
14+
## Using a Docker Container
15+
16+
Follow these instructions for remote development using a Docker Container.
17+
18+
### Install
19+
20+
To start remote development in dev container, install:
21+
22+
- Docker Desktop. For system requirements and installation instructions, see:
23+
- [Windows](https://docs.docker.com/docker-for-windows/install/): Currently Docker desktop for windows supports only Linux Containers and [not Windows Containers](https://code.visualstudio.com/docs/remote/containers#_known-limitations). During the install process, ensure you use the default option of Linux Containers.
24+
- [Mac](https://docs.docker.com/docker-for-mac/install/)
25+
- [Linux](https://docs.docker.com/engine/install/debian/)
26+
- Latest version of [VS Code](https://code.visualstudio.com/download)
27+
- Latest version of [VS Code Remote Development Extension Pack](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack). After you install VS Code and Docker - Desktop for your operating system:
28+
- For Windows, set source code locations you want to open in a container. In Docker, right-click and select **Settings / Preferences > Shared Drives / File Sharing**. See [Container tips](https://code.visualstudio.com/docs/remote/troubleshooting#_container-tips) if you hit trouble with sharing.
29+
- For Linux, see [supported platforms](https://docs.docker.com/get-docker/). From the terminal, run `sudo usermod -aG docker $USER` to add your user to the docker group. This setting takes effect after you sign out and back in again.
30+
31+
### Open a Project in a Dev Container
32+
33+
1. Open the project you want to work with or create a new project
34+
2. From the Command Palette, run **Remote-Containers: Reopen in Container**. If you are unable to see this command, make sure that you have installed the latest version of VS Code Remote Development Extension Pack.
35+
36+
VS Code creates a dev container the first time you open the project. After the dev container is built, the project folder in your local system automatically connects and maps to the container, and the side bar shows `Dev Container: Screeps-TypeScript-Starter`.
37+
38+
![remote-container](../.gitbook/assets/remote-container.png)
39+
40+
The container pre-installs and configures all Pre-Requisites for this project + other utils for your daily basis:
41+
42+
- Node 12
43+
- git
44+
- ca-certificates
45+
- openssl
46+
- openssh

0 commit comments

Comments
 (0)