-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate Neovim into development workflow
- Loading branch information
1 parent
e07ff9d
commit 172e024
Showing
3 changed files
with
65 additions
and
31 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,11 +1,56 @@ | ||
FROM mcr.microsoft.com/devcontainers/javascript-node:22 AS base | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
FROM node:22-bookworm AS system | ||
USER root | ||
ENV HOME="/home/node" | ||
ENV DEBIAN_FRONTEND="noninteractive" | ||
WORKDIR /workspace | ||
|
||
RUN ["apt", "update"] | ||
RUN ["apt", "install", "-y", "curl", "unzip"] | ||
RUN ["apt-get", "update"] | ||
RUN ["apt-get", "dist-upgrade", "-y"] | ||
RUN ["apt-get", "install", "-y", "ripgrep", "sudo", "unzip", "zsh"] | ||
|
||
FROM base AS bun | ||
FROM system AS user | ||
USER root | ||
|
||
RUN usermod -s /usr/bin/zsh node \ | ||
&& echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers; | ||
|
||
FROM user AS cargo | ||
USER node | ||
|
||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y \ | ||
&& . $HOME/.cargo/env \ | ||
&& rustup default stable; | ||
|
||
FROM user AS stylua | ||
USER root | ||
WORKDIR /usr/bin | ||
|
||
RUN curl -L https://github.com/JohnnyMorganz/StyLua/releases/download/v0.20.0/stylua-linux-x86_64.zip -o stylua.zip \ | ||
&& unzip stylua.zip; | ||
|
||
# TODO: See if you can steal the Neovim executable from an existing Neovim image | ||
# running Debian Bookworm to improve performance by avoiding archive extraction | ||
FROM user AS neovim | ||
USER root | ||
WORKDIR /neovim | ||
|
||
RUN curl -L https://github.com/neovim/neovim/releases/download/v0.10.1/nvim-linux64.tar.gz -o neovim.zip \ | ||
&& tar -xzf neovim.zip --strip-components=1 \ | ||
&& rm neovim.zip; | ||
|
||
FROM user AS bun | ||
USER node | ||
ENV BUN_INSTALL="$HOME/.bun" | ||
|
||
RUN curl -fsSL https://bun.sh/install | bash; | ||
|
||
FROM user AS final | ||
USER root | ||
|
||
COPY --from=cargo $HOME/.cargo/ $HOME/.cargo/ | ||
COPY --from=stylua /usr/bin/stylua /usr/bin/stylua | ||
COPY --from=neovim /neovim/ /usr/ | ||
COPY --from=bun /home/node/.bun/ /home/node/.bun/ | ||
|
||
RUN curl -fsSL https://bun.sh/install | bash | ||
RUN ["apt-get", "clean"] | ||
RUN ["apt-get", "autoremove", "-y"] |
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,34 +1,11 @@ | ||
{ | ||
"name": "Astro App Boilerplate", | ||
"dockerFile": "Dockerfile", | ||
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", | ||
"workspaceFolder": "/workspace", | ||
"remoteUser": "node", | ||
"postCreateUser": "node", | ||
"postCreateCommand": "bun install && (bun pm trust --all || true) && bun run prepare", | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"Gruntfuggly.todo-tree", | ||
"YoavBls.pretty-ts-errors", | ||
"astro-build.astro-vscode", | ||
"better-ts-errors.better-ts-errors", | ||
"bradlc.vscode-tailwindcss", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode", | ||
"henriiik.vscode-sort", | ||
"mikestead.dotenv", | ||
"neotan.vscode-auto-restart-typescript-eslint-servers", | ||
"streetsidesoftware.code-spell-checker", | ||
"wayou.vscode-todo-highlight", | ||
"wix.vscode-import-cost" | ||
], | ||
"settings": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} | ||
} | ||
}, | ||
"postCreateCommand": ".devcontainer/setup.sh", | ||
"features": { | ||
"ghcr.io/devcontainers/features/git": {}, | ||
"ghcr.io/devcontainers/features/github-cli": {} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
export BUN_INSTALL="/home/node/.bun" | ||
export PATH="$PATH:$BUN_INSTALL/bin" | ||
|
||
bun install | ||
bun pm trust --all || true | ||
|
||
if [ ! -d .husky/_ ]; then | ||
bun run prepare | ||
fi |