Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: add devcontainer files #22

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
36 changes: 36 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# [Choice] Debian OS version: bullseye, buster
ARG VARIANT=bullseye
FROM --platform=linux/amd64 mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT}

# update system packages and cleanup cache
ARG DEBIAN_FRONTEND=noninteractive

# install gcc, git-extras, gnu coreutils
RUN sudo apt-get -y update \
&& sudo apt-get -y install --no-install-recommends gcc git-extras coreutils \
&& sudo apt-get -y upgrade && sudo rm -rf /var/lib/apt/lists/*

# install latest deno and upgrade to canary
ENV DENO_INSTALL=/home/${USER:-vscode}/.local DENO_INSTALL_ROOT=${DENO_INSTALL}/bin
RUN curl -fsSL https://deno.land/install.sh | sh \
&& chown ${USER:-vscode} /home/${USER:-vscode}/.local/bin/deno \
&& /home/${USER:-vscode}/.local/bin/deno upgrade canary

# install brew and add to path
RUN /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" \
&& echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> /home/${USER:-vscode}/.bashrc

# install starship and configure some defaults
RUN curl -fsSL https://starship.rs/install.sh | sh -s -- -y \
&& chown ${USER:-vscode} /home/${USER:-vscode}/.local/bin/starship \
&& { \
echo 'export PATH="$HOME/.local/bin:$PATH";'; \
echo 'export STARSHIP_CONFIG="${HOME}/.config/starship.toml";'; \
echo 'test -d "${HOME}/.config" || mkdir -p "${HOME}/.config";'; \
echo 'test -f "${STARSHIP_CONFIG}" || starship preset -o "${STARSHIP_CONFIG}" tokyo-night;'; \
echo 'eval "$(starship init bash)";'; \
} >> /home/${USER:-vscode}/.bashrc

# install bash completions for deno
RUN sudo mkdir -p /etc/bash_completion.d \
&& /home/${USER:-vscode}/.local/bin/deno completions bash > /etc/bash_completion.d/deno.bash
57 changes: 57 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "@decorators",
"dockerFile": "Dockerfile",
"remoteUser": "vscode",
"features": {
// the basics
"git": "latest",
"sshd": "latest",
"node": "latest",
// github cli
"ghcr.io/devcontainers/features/github-cli:1": {},
// github actions
"ghcr.io/devcontainers-contrib/features/act:1": {},
"ghcr.io/devcontainers-contrib/features/actionlint:1": {}
},
"build": {},
"updateRemoteUserUID": true,
// settings for the vscode editor
"customizations": {
"codespaces": {
"openFiles": [
"README.md",
"deno.json"
]
},
"vscode": {
"settings": {
"deno.enable": true,
"deno.future": true, // TODO(nberlette): remove once deno 2.0 lands
"deno.lint": true,
"deno.codeLens.test": true,
"deno.cacheOnSave": true,
"deno.codeLens.testArgs": ["-A", "--no-check=remote", "--parallel", "--clean", "--doc"],
"editor.tabSize": 2,
"editor.stickyTabStops": true,
"editor.linkedEditing": true,
"editor.minimap.enabled": false,
"[typescript][typescriptreact][javascript][javascriptreact][json][jsonc][markdown]": {
"editor.defaultFormatter": "denoland.vscode-deno",
"editor.formatOnPaste": false,
"editor.formatOnSave": true
}
},
"extensions": [
"github.theme",
"github.vscode-github-actions",
"github.copilot",
"denoland.vscode-deno",
"editorconfig.editorconfig",
"redhat.vscode-yaml",
"bierner.markdown-preview-github-styles",
"mutantdino.resourcemonitor"
]
}
},
"updateContentCommand": "sudo deno upgrade --canary --force 2>&1"
}