Skip to content
This repository has been archived by the owner on Sep 14, 2023. It is now read-only.

chore: update devcontainer docker image #208

Merged
merged 11 commits into from
Sep 9, 2022
26 changes: 20 additions & 6 deletions .devcontainer/devcontainer.json
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]": {
kratico marked this conversation as resolved.
Show resolved Hide resolved
"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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can get rid of this as well, as I believe we no longer have any toml in this repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a book.toml file.
Shall I remove it anyway?

"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"
}
4 changes: 2 additions & 2 deletions .gitpod.yml
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

- denoland.vscode-deno
- dprint.dprint
- esbenp.prettier-vscode
- matklad.rust-analyzer
- ms-azuretools.vscode-docker
- serayuzgur.crates
- streetsidesoftware.code-spell-checker
- vadimcn.vscode-lldb
1 change: 0 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"dprint.dprint",
"esbenp.prettier-vscode",
"ms-azuretools.vscode-docker",
"serayuzgur.crates",
"streetsidesoftware.code-spell-checker",
"vadimcn.vscode-lldb"
]
Expand Down
27 changes: 17 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
FROM mcr.microsoft.com/vscode/devcontainers/rust:0-1
ARG DENO_VERSION=1.25.1

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
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get install -y unzip curl git \
&& 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 curl -fsSL https://deno.land/x/install/install.sh | sh
RUN curl -fsSL https://dprint.dev/install.sh | sh

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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gitpod does not support multistage builds but VSCode devcontainer extension supports multi stage builds.

With this setup

  • gitpod, uses the last stage to configure the container image
  • devcontainer, uses the vscode stage configured in devcontainer.json


# 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
3 changes: 3 additions & 0 deletions words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,6 @@ Lxkf
Tpeyg
getrandom
Curto
devcontainers
noninteractive
autoremove