This repo builds a custom WSL rootfs (tarball) locally or via CI (CodeBuild/GitHub Actions) and uploads it to S3 for distribution.
This custom WSL image comes pre-installed with a comprehensive suite of development tools:
- Node.js: v22 (via
nvm) - Go: v1.23.9
- Java: OpenJDK 17 (or 11 fallback)
- Rust: Installed via
rustup - Python: Python 3 with
pipandvenv - C/C++:
build-essential,gcc,g++,clang,make
- AWS: AWS CLI v2
- Azure: Azure CLI
- Docker: Docker CLI (
docker.io) - Terraform: HashiCorp Terraform
- Kubernetes:
kubectl(Latest stable)helm(Helm 3)kustomizekind(Kubernetes in Docker)minikubek9s(Terminal UI for K8s)
- Security:
trivy(Container security scanner)
- Package Managers:
npm,yarn,pnpm - Bundlers/Tools:
typescript,vite,webpack,webpack-cli - IDE:
code-server(VS Code in the browser)
- Git:
gitandgh(GitHub CLI) - Data Processing:
jq(JSON),yq(YAML) - Modern Unix Tools:
fzf(Fuzzy finder),ripgrep(rg),bat(cat clone) - Document Processing:
texlive-full(LaTeX for typesetting documents) - System:
htop,curl,wget,unzip,zip,net-tools,iproute2,procps
On Ubuntu (or WSL host with sudo):
- sudo apt-get update
- sudo apt-get install -y debootstrap tar xz-utils sudo
- sudo bash build.sh
- Copy
custom-wsl.tar.gzto Windows and import:- use
windows/install-wsl-image.ps1or:wsl --import MyDevDistro C:\WSL\MyDevDistro C:\path\to\custom-wsl.tar.gz --version 2
- use
Optional: enable systemd by adding [boot]\nsystemd=true to /etc/wsl.conf inside the distro and run wsl --shutdown.
Option 1 — CloudFormation:
- Push repo to GitHub.
- Deploy CloudFormation: provide GitHubOwner, GitHubRepo, GitHubBranch, GitHubToken, and optionally
ReleaseBucketName.
aws cloudformation deploy --template-file cloudformation/pipeline.yml --stack-name wsl-image-pipeline \
--parameter-overrides GitHubOwner=your-github-username GitHubRepo=your-repo-name GitHubBranch=main GitHubToken=ghp_YOUR_TOKEN ReleaseBucketName=my-wsl-images- Pipeline will produce
custom-wsl-<DATE>-<BUILD>.tar.gzandcustom-wsl-latest.tar.gzin the Release Bucket (if specified).
Option 2 — GitHub Actions (OIDC):
- Deploy the OIDC setup stack to create the S3 bucket and IAM role:
aws cloudformation deploy --template-file cloudformation/github-oidc-setup.yml --stack-name wsl-oidc-setup \ --capabilities CAPABILITY_NAMED_IAM --parameter-overrides GitHubOrg=your-github-org GitHubRepo=your-repo-name
- Note the
RoleArnandBucketNamefrom the stack outputs. You can retrieve these values using the AWS CLI:aws cloudformation describe-stacks --stack-name wsl-oidc-setup --query 'Stacks[0].Outputs' - Add the following secrets to your GitHub repository:
AWS_ROLE_ARN: The Role ARN from step 2.S3_BUCKET: The Bucket Name from step 2.AWS_REGION: Your AWS region (e.g.,us-east-1).
- Push to
mainto trigger the build. The workflow uses OIDC for secure, temporary credentials.
Use windows/import-and-setup.ps1 to download & import. You can specify a version (default is "latest").
.\windows\import-and-setup.ps1 -BucketName "my-wsl-images" -Version "latest" -DistroName "MyDevDistro"- Create a
packages.txtfile in the root to override the default package list.
- No VPC needed for typical builds.
- Image sizes will be large if you include everything; consider a minimal variant.
- Add IAM least-privilege for production.