Skip to content

Commit b830214

Browse files
committed
initial commit
0 parents  commit b830214

File tree

6 files changed

+125
-0
lines changed

6 files changed

+125
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @6thpath

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Phát Mai
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Devcontainers for Node.js & TypeScript
2+
3+
This repository provides opinionated [devcontainer](https://containers.dev/) images optimized for use with Visual Studio Code Remote - Containers.
4+
5+
## Available Devcontainers
6+
- [Typescript & Node.js](https://hub.docker.com/r/6thpath/typescript-node)

source/.gitkeep

Whitespace-only changes.

source/typescript-node/Dockerfile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
ARG VARIANT="22-bookworm-slim"
2+
FROM node:${VARIANT}
3+
4+
# set working directory
5+
WORKDIR /workspaces
6+
7+
# install system dependencies for development
8+
RUN apt-get update && apt-get install -y \
9+
git \
10+
curl \
11+
zsh \
12+
&& rm -rf /var/lib/apt/lists/* \
13+
&& apt-get clean
14+
15+
# enable Corepack and install pnpm
16+
RUN corepack enable \
17+
&& corepack prepare pnpm@latest --activate
18+
19+
# setup for pnpm
20+
ENV PNPM_HOME="/pnpm"
21+
ENV PATH="${PNPM_HOME}:${PATH}"
22+
23+
# variables for image configurations
24+
ARG GROUP_NAME=dev
25+
ARG USER_NAME=nonroot
26+
27+
# creates non-root user for security
28+
RUN groupadd ${GROUP_NAME} \
29+
&& useradd -m -s /bin/bash -g ${GROUP_NAME} ${USER_NAME} \
30+
&& mkdir -p ${PNPM_HOME}/store \
31+
&& chown -R ${USER_NAME}:${GROUP_NAME} ${PNPM_HOME} /workspaces \
32+
&& chmod -R 775 ${PNPM_HOME}
33+
34+
# configure pnpm store directory and settings
35+
RUN pnpm config set store-dir ${PNPM_HOME}/store
36+
37+
# install global development tools
38+
RUN pnpm add -g \
39+
eslint \
40+
prettier \
41+
typescript
42+
43+
RUN usermod -s /bin/zsh ${USER_NAME}
44+
45+
# switch to remote user
46+
USER ${USER_NAME}
47+
48+
# install Oh My ZSH
49+
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
50+
51+
# install additional zsh plugins
52+
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions && \
53+
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting && \
54+
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-completions
55+
56+
# create custom .zshrc
57+
RUN cat > ~/.zshrc <<'EOF'
58+
export ZSH="$HOME/.oh-my-zsh"
59+
60+
ZSH_THEME="robbyrussell"
61+
62+
plugins=( z git zsh-autosuggestions zsh-syntax-highlighting )
63+
64+
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
65+
autoload -U compinit && compinit
66+
source $ZSH/oh-my-zsh.sh
67+
EOF

source/typescript-node/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Node.js & TypeScript
2+
3+
## Summary
4+
5+
Opinionated `Dockerfile` for Node.js and TypeScript development. This image includes a set of common tools and configurations for a smooth development experience.
6+
7+
- This image is built on top of the [Node.js](https://hub.docker.com/_/node) base image. Default image variant is `22-bookworm-slim`, which is based on the latest LTS version of Node.js (22.x) and Debian Bookworm.
8+
- [How to choose Node.js container image](https://labs.iximiuz.com/tutorials/how-to-choose-nodejs-container-image)
9+
- [Choosing the best Node.js Docker image](https://snyk.io/blog/choosing-the-best-node-js-docker-image/)
10+
- Package Manager is set up through corepack, [PNPM](https://pnpm.io/) is enabled and configured by default.
11+
- Common tools like `eslint`, `prettier`, and `typescript` are included.
12+
- It includes `git`, `curl`, `zsh`, [`Oh My Zsh!`](https://ohmyz.sh/), a non-root `nonroot` user and a set of common dependencies for development.
13+
- `Oh My Zsh!` common plugins like `z`, `zsh-completions`, `zsh-autosuggestions` and `zsh-syntax-highlighting` are included for a better shell experience.
14+
- Non-root user (`nonroot`) with limited permissions for improved security.
15+
16+
| Option | Description | Type | Default Value |
17+
|-----------|-------------|------|---------------|
18+
| VARIANT | The image variant to use. See [supported tags](https://hub.docker.com/_/node) | `string` | `22-bookworm-slim` |
19+
20+
## Using this image
21+
22+
You can directly reference pre-built versions of `Dockerfile` by using the `image` property in `.devcontainer/devcontainer.json` or updating the `FROM` statement in your own `Dockerfile` to one of the following. An example `Dockerfile` is included in this repository.
23+
24+
- `ghcr.io/6thpath/devcontainer-images/typescript-node:22-bookworm-slim`
25+
26+
Refer to [this guide](https://containers.dev/guide/dockerfile) for more details.
27+
28+
## License
29+
30+
This project is licensed under the [MIT License](https://github.com/6thpath/devcontainer-images/blob/main/LICENSE).

0 commit comments

Comments
 (0)