TypeScript Dev Container Revisited: The February 2023 Edition
One of my favorite topics is the developer experience. Making it easy to set up and use an efficient and standardized development environment allows software engineers to spend more time on productive items instead of having to continuously deal with tool sets. Therefore, I maintain GitHub repositories with templates for different programming languages.
One of these template repositories is for a dev container for TypeScript and NodeJS. I have written posts in the past providing details for the initial steps of creating a dev container. In this post I will cover my recent experiences of upgrading to the newest LTS version 18.14.0 of NodeJS.
In this article I will cover these topics:
- Upgrade the base image
- Upgrade npm
- Upgrade TypeScript
- Resolve issues with the initialization script for the dev container
The complete source code can be found at https://github.com/RimuTec/dev-container-typescript. It is available for forking or use as a template.
Upgrading the Tool Set
The simplest part of this upgrade was changing the base image, npm and TypeScript. All I had to do was changing the Dockerfile. Previously, the Dockerfile looked like this:
From here it was not a challenge to make the required changes. After applying them the Dockerfile looked as follows:
All of this was fine to build the container. However, when I tried to start it, it would fall over with a log output in Docker with a couple of entries like this one: