Feature/remote container development (#154)
* feat: add Dockerfile, config & recommended extenion * docs: add remote-development documentation * docs: fix README & installation to match node versions package.json definition
This commit is contained in:
committed by
GitHub
parent
c89e174d26
commit
66a323425e
4
.devcontainer/Dockerfile
Normal file
4
.devcontainer/Dockerfile
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
FROM node:12-alpine
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache git ca-certificates openssl openssh
|
||||||
|
RUN npm install -g rollup
|
||||||
31
.devcontainer/devcontainer.json
Normal file
31
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
||||||
|
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.0/containers/docker-existing-dockerfile
|
||||||
|
{
|
||||||
|
"name": "Screeps-TypeScript-Starter",
|
||||||
|
|
||||||
|
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
|
||||||
|
"dockerFile": "Dockerfile",
|
||||||
|
|
||||||
|
// Set *default* container specific settings.json values on container create.
|
||||||
|
"settings": {
|
||||||
|
"terminal.integrated.shell.linux": null
|
||||||
|
},
|
||||||
|
|
||||||
|
// Add the IDs of extensions you want installed when the container is created.
|
||||||
|
"extensions": []
|
||||||
|
|
||||||
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
|
// "forwardPorts": [],
|
||||||
|
|
||||||
|
// Uncomment the next line to run commands after the container is created - for example installing curl.
|
||||||
|
// "postCreateCommand": "apt-get update && apt-get install -y curl",
|
||||||
|
|
||||||
|
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
|
||||||
|
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
|
||||||
|
|
||||||
|
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
|
||||||
|
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
|
||||||
|
|
||||||
|
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
|
||||||
|
// "remoteUser": "vscode"
|
||||||
|
}
|
||||||
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"recommendations": [
|
||||||
|
"ms-vscode-remote.vscode-remote-extensionpack"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ Screeps Typescript Starter is a starting point for a Screeps AI written in Types
|
|||||||
|
|
||||||
You will need:
|
You will need:
|
||||||
|
|
||||||
- [Node.JS](https://nodejs.org/en/download) (10.x)
|
- [Node.JS](https://nodejs.org/en/download) (10.x || 12.x)
|
||||||
- A Package Manager ([Yarn](https://yarnpkg.com/en/docs/getting-started) or [npm](https://docs.npmjs.com/getting-started/installing-node))
|
- A Package Manager ([Yarn](https://yarnpkg.com/en/docs/getting-started) or [npm](https://docs.npmjs.com/getting-started/installing-node))
|
||||||
- Rollup CLI (Optional, install via `npm install -g rollup`)
|
- Rollup CLI (Optional, install via `npm install -g rollup`)
|
||||||
|
|
||||||
|
|||||||
BIN
docs/.gitbook/assets/remote-container.png
Normal file
BIN
docs/.gitbook/assets/remote-container.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
@@ -1,23 +1,23 @@
|
|||||||
# Table of contents
|
# Table of contents
|
||||||
|
|
||||||
* [Introduction](README.md)
|
- [Introduction](README.md)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
* [Installation](getting-started/installation.md)
|
- [Installation](getting-started/installation.md)
|
||||||
* [Authenticating with Screeps](getting-started/authenticating.md)
|
- [Authenticating with Screeps](getting-started/authenticating.md)
|
||||||
* [Deploying](getting-started/deploying.md)
|
- [Deploying](getting-started/deploying.md)
|
||||||
|
|
||||||
## In-Depth
|
## In-Depth
|
||||||
|
|
||||||
* [Module bundling](in-depth/module-bundling.md)
|
- [Module bundling](in-depth/module-bundling.md)
|
||||||
* [Deploy destinations](in-depth/deploy-destinations.md)
|
- [Deploy destinations](in-depth/deploy-destinations.md)
|
||||||
* [TypeScript](in-depth/typescript.md)
|
- [TypeScript](in-depth/typescript.md)
|
||||||
* [Prettier](in-depth/prettier.md)
|
- [Prettier](in-depth/prettier.md)
|
||||||
* [Testing](in-depth/testing.md)
|
- [Testing](in-depth/testing.md)
|
||||||
* [Cookbook](in-depth/cookbook/README.md)
|
- [Cookbook](in-depth/cookbook/README.md)
|
||||||
* [Environment variables](in-depth/cookbook/environment-variables.md)
|
- [Environment variables](in-depth/cookbook/environment-variables.md)
|
||||||
* [One-line PowerShell setup](in-depth/cookbook/one-line-powershell.md)
|
- [One-line PowerShell setup](in-depth/cookbook/one-line-powershell.md)
|
||||||
* [Troubleshooting](in-depth/troubleshooting.md)
|
- [Remote Development](in-depth/remote-development.md)
|
||||||
* [Contributing to the docs](in-depth/contributing.md)
|
- [Troubleshooting](in-depth/troubleshooting.md)
|
||||||
|
- [Contributing to the docs](in-depth/contributing.md)
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
You will need:
|
You will need:
|
||||||
|
|
||||||
* [Node.JS](https://nodejs.org/en/download) \(>= 8.0.0\)
|
- [Node.JS](https://nodejs.org/en/download) (10.x || 12.x)
|
||||||
* A Package Manager \([Yarn](https://yarnpkg.com/en/docs/getting-started) or [npm](https://docs.npmjs.com/getting-started/installing-node)\)
|
- A Package Manager \([Yarn](https://yarnpkg.com/en/docs/getting-started) or [npm](https://docs.npmjs.com/getting-started/installing-node)\)
|
||||||
* Rollup CLI \(Optional, install via `npm install -g rollup`\)
|
- Rollup CLI \(Optional, install via `npm install -g rollup`\)
|
||||||
|
|
||||||
## Installing `npm` modules
|
## Installing `npm` modules
|
||||||
|
|
||||||
@@ -21,4 +21,3 @@ yarn
|
|||||||
```
|
```
|
||||||
|
|
||||||
Once that's all done, let's [authenticate with the Screeps server](authenticating.md).
|
Once that's all done, let's [authenticate with the Screeps server](authenticating.md).
|
||||||
|
|
||||||
|
|||||||
46
docs/in-depth/remote-development.md
Normal file
46
docs/in-depth/remote-development.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# Remote Development
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Keep your Screeps-TypeScript project isolated with its dependencies within a container!
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Refer to VS Code documentation if you want to understand more about remote development:
|
||||||
|
|
||||||
|
- 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)
|
||||||
|
- Switch your development environment by [connecting to a container](https://code.visualstudio.com/docs/remote/containers)
|
||||||
|
|
||||||
|
## Using a Docker Container
|
||||||
|
|
||||||
|
Follow these instructions for remote development using a Docker Container.
|
||||||
|
|
||||||
|
### Install
|
||||||
|
|
||||||
|
To start remote development in dev container, install:
|
||||||
|
|
||||||
|
- Docker Desktop. For system requirements and installation instructions, see:
|
||||||
|
- [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.
|
||||||
|
- [Mac](https://docs.docker.com/docker-for-mac/install/)
|
||||||
|
- [Linux](https://docs.docker.com/engine/install/debian/)
|
||||||
|
- Latest version of [VS Code](https://code.visualstudio.com/download)
|
||||||
|
- 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:
|
||||||
|
- 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.
|
||||||
|
- 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.
|
||||||
|
|
||||||
|
### Open a Project in a Dev Container
|
||||||
|
|
||||||
|
1. Open the project you want to work with or create a new project
|
||||||
|
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.
|
||||||
|
|
||||||
|
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`.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The container pre-installs and configures all Pre-Requisites for this project + other utils for your daily basis:
|
||||||
|
|
||||||
|
- Node 12
|
||||||
|
- git
|
||||||
|
- ca-certificates
|
||||||
|
- openssl
|
||||||
|
- openssh
|
||||||
Reference in New Issue
Block a user