This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update devcontainer docker image (#208)
* chore: update devcontainer docker image * chore: remove rust extension from devcontainer.json and .gitpod.yml * chore: update Dockerfile base image to denoland/deno * chore: add custom docker image for Gitpod * chore: unset DENO_DIR for Gitpod * chore: set deno as container user * chore: add multistage container * chore: add polkadot binary * chore: update Readme * feat: update docker image to download polkadot from GH releases
- Loading branch information
Showing
6 changed files
with
61 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,42 @@ | ||
{ | ||
"name": "Capi", | ||
"build": { | ||
"dockerfile": "../Dockerfile" | ||
"dockerfile": "../Dockerfile", | ||
"target": "vscode" | ||
}, | ||
"settings": { | ||
"files.watcherExclude": { | ||
"**/.git/objects/**": true, | ||
"**/.git/subtree-cache/**": true, | ||
"target/**": true | ||
}, | ||
"dprint.path": "/home/vscode/.dprint/bin/dprint" | ||
"[jsonc]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[yaml]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
}, | ||
"[typescript]": { | ||
"editor.defaultFormatter": "dprint.dprint" | ||
}, | ||
"deno.codeLens.testArgs": ["--no-check=remote", "-A", "-L=info"], | ||
"deno.config": "./deno.jsonc", | ||
"deno.enable": true, | ||
"deno.lint": true, | ||
"editor.defaultFormatter": "dprint.dprint", | ||
"editor.formatOnSave": true, | ||
"editor.tabSize": 2, | ||
"prettier.printWidth": 100 | ||
}, | ||
"extensions": [ | ||
"EditorConfig.EditorConfig", | ||
"bungcip.better-toml", | ||
"denoland.vscode-deno", | ||
"dprint.dprint", | ||
"esbenp.prettier-vscode", | ||
"rust-lang.rust-analyzer", | ||
"ms-azuretools.vscode-docker", | ||
"serayuzgur.crates", | ||
"streetsidesoftware.code-spell-checker", | ||
"vadimcn.vscode-lldb" | ||
], | ||
"postCreateCommand": "deno task bootstrap", | ||
"remoteUser": "vscode" | ||
"postCreateCommand": "deno task star" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
image: | ||
file: Dockerfile | ||
tasks: | ||
- init: deno task star | ||
vscode: | ||
extensions: | ||
- EditorConfig.EditorConfig | ||
- bungcip.better-toml | ||
- denoland.vscode-deno | ||
- dprint.dprint | ||
- esbenp.prettier-vscode | ||
- matklad.rust-analyzer | ||
- ms-azuretools.vscode-docker | ||
- serayuzgur.crates | ||
- streetsidesoftware.code-spell-checker | ||
- vadimcn.vscode-lldb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-1 | ||
ARG DENO_VERSION=1.25.2 | ||
|
||
RUN rustup target add wasm32-unknown-unknown | ||
FROM denoland/deno:${DENO_VERSION} as vscode | ||
|
||
ENV DENO_INSTALL=/usr/local | ||
# crates.io index update fails without this (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=918854) | ||
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
ARG POLKADOT_VERSION=v0.9.25 | ||
|
||
RUN curl -fsSL https://deno.land/x/install/install.sh | sh | ||
RUN curl -fsSL https://dprint.dev/install.sh | sh | ||
RUN export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get update \ | ||
&& apt-get install -y unzip curl git \ | ||
&& curl -L -o /usr/local/bin/polkadot https://github.com/paritytech/polkadot/releases/download/${POLKADOT_VERSION}/polkadot \ | ||
&& chmod +x /usr/local/bin/polkadot \ | ||
&& curl -fsSL https://dprint.dev/install.sh | DPRINT_INSTALL=/usr/local sh \ | ||
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ | ||
&& apt-get install -y nodejs \ | ||
&& npm -g install cspell@latest \ | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN export PATH=/usr/local/cargo/bin:$PATH | ||
RUN export DPRINT_INSTALL="/home/vscode/.dprint" | ||
RUN export PATH="$DPRINT_INSTALL/bin:$PATH" | ||
|
||
FROM vscode as gitpod | ||
|
||
# Gitpod creates a gitpod user to run without privileges | ||
# following https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user | ||
ENV DENO_DIR=/home/gitpod/.cache/deno |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,15 +181,25 @@ for await (const event of result) { | |
## Environment setup | ||
|
||
> In the future, Gitpod and dev containers will simplify spinning up a Capi development environments. The [Dockerfile](./Dockerfile), [Gitpod configuration](./.gitpod.yml) and [Dev Containers / Codespaces configuration](./.devcontainer/devcontainer.json) are in need some finessing. | ||
### Container environment setup | ||
|
||
Make sure you have the following installed on your machine (and please submit issues if errors crop up). | ||
Develop in the cloud with | ||
|
||
### System Requirements | ||
[![Gitpod Open](https://img.shields.io/badge/Gitpod-Open-blue?logo=gitpod)](https://gitpod.io/#https://github.com/paritytech/capi) | ||
|
||
- [Deno](https://deno.land/[email protected]/getting_started/installation) | ||
Develop locally using the [VSCode Remote Container](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension and [Docker](https://docs.docker.com/get-docker/) | ||
|
||
[![Open in Remote - Containers](https://img.shields.io/badge/Remote_--_Container-Open-blue?logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/paritytech/capi) | ||
|
||
### Local environment setup | ||
|
||
Develop on your machine installing the following (and please submit issues if errors crop up) | ||
|
||
- [Deno](https://deno.land/manual/getting_started/installation) | ||
- [Docker](https://docs.docker.com/get-docker/) | ||
- [NodeJS](https://nodejs.org/) (only necessary if you're going to run [the build_npm task](./_/tasks/build_npm.ts)) | ||
- [NodeJS](https://nodejs.org/) | ||
- [`dprint`](https://dprint.dev/) | ||
- [`cspell`](https://cspell.org/) | ||
|
||
### Running an Example | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,3 +168,6 @@ Lxkf | |
Tpeyg | ||
getrandom | ||
Curto | ||
devcontainers | ||
noninteractive | ||
autoremove |