Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Argument for the pnpm version to install
ARG PNPM_VERSION="latest"
# Which image to use as a base
ARG IMAGE="mcr.microsoft.com/devcontainers/javascript-node"
# Which tag to use for the image
ARG VARIANT="20-bookworm"

# Arguments related to setting up a non-root user for the container
ARG USERNAME=node

#########################
# Final image
#########################
FROM ${IMAGE}:${VARIANT}

# Make sure arguments are available
ARG PNPM_VERSION
ARG USERNAME

RUN apt update \
# Upgrade the system
&& apt upgrade -yq \
# Install general utilities
&& apt install -yq --no-install-recommends sudo software-properties-common ca-certificates apt-transport-https \
git git-lfs bash-completion curl wget \
# Update ca-certificates
&& update-ca-certificates \
# Install package managers
&& npm i -g npm \
&& npm i -g yarn \
&& npm i -g pnpm@${PNPM_VERSION} \
# Set up pnpm
&& SHELL=bash pnpm setup \
# Easier tabbing through files
&& echo "bind TAB:menu-complete" >>/home/${USERNAME}/.bashrc \
&& echo "bind '\"\e[Z\":menu-complete-backward'" >>/home/${USERNAME}/.bashrc \
# Make the user a sudo user
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
# Remove some bloat
&& apt clean

EXPOSE 3000
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "Tauri Docs",
"runArgs": [],
"forwardPorts": [],
"mounts": [],
"build": {
"dockerfile": "Dockerfile",
"args": {}
},
"customizations": {
"settings": {
"extensions.installRecommended": true
},
"extensions": [
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big fan of pushing all those third party extensions in the container by default. Are they needed for usage or do they provide convenience from your personal perspective?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Astro one at least is basically needed for usage. Several of the others are less about being "needed" and more about providing developers with a similar setup of tools related to things like linting and task management. Technically all extensions are always optional, Notepad is the best IDE after all x)

Also it's reeeally annoying to have to manually install all recommended extensions when you load up the repo, this is the only way to make it as quick and easy to just boot up and start editing with. Remember that if it's ultimate customization you want a devcontainer may not be the best to use in the first place, and the main purpose of this devcontainer is to get people up and running quickly.

That's my take on it at least, but I'm not impossible to convince otherwise. I'm not super emotionally attached to the devcontainer.

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather trim it down to only the Astro extension. The idea of having a dev container in the first place is to get something spun up super quick and easy and we should keep the plugins to a minimum to achieve that.

If we slim it down to only Astro's plugin then I think extensions.installRecommended is fine.

"dbaeumer.vscode-eslint", // ESLint
"waderyan.gitblame", // Shows blame in source code
"GitHub.vscode-pull-request-github", // Pull requests
"codezombiech.gitignore", // .gitignore
"numso.prettier-standard-vscode", // Prettier
"Gruntfuggly.todo-tree", // To do
"MarkosTh09.color-picker", // Color picker
"redhat.vscode-yaml", // Yaml
"astro-build.astro-vscode" // Astro
]
},
"features": {}
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ pnpm-debug.log*

# macOS-specific files
.DS_Store

# PNPM
.pnpm-store
8 changes: 6 additions & 2 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
image:
file: .devcontainer/Dockerfile
tasks:
- init: pnpm install && pnpm dev:setup
command: pnpm run dev
- init: |
pnpm install
pnpm dev:setup
command: pnpm dev
ports:
- port: 3000
onOpen: open-browser
12 changes: 11 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"recommendations": ["astro-build.astro-vscode"],
"recommendations": [
"dbaeumer.vscode-eslint", // ESLint
"waderyan.gitblame", // Shows blame in source code
"GitHub.vscode-pull-request-github", // Pull requests
"codezombiech.gitignore", // .gitignore
"numso.prettier-standard-vscode", // Prettier
"Gruntfuggly.todo-tree", // To do
"MarkosTh09.color-picker", // Color picker
"redhat.vscode-yaml", // Yaml
"astro-build.astro-vscode" // Astro
],
Comment on lines +2 to +12
Copy link
Member

Choose a reason for hiding this comment

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

Some comment on this, let's only do the Astro plugin

"unwantedRecommendations": []
}