🚨 This project is used for giving dev container presentations/demos. It is not meant to show "good" or production ready code. The purpose is to show how a fully configured development environment can be spun up in isolation from the host machine in minutes.
Dev Containers
are a feature currently shipping for Visual Studio Code (as an extension) utilizing containers to create fully configured and version controlled development environments.
- Team members are always working from the same:
- Base Operating System
- Network Stack
- Required Extensions and Configuration
- CLI Tools
- Host OS agnostic.
- Full project setup in minutes.
- Version controlled Development experience.
- Can be hosted in the cloud (Example: GitHub Codespaces).
- ⭐️ NEW: Multiple Configurations Per Project allowing for different setups for different types of work.
- Slower than running on the Host OS.
- Currently a Visual Studio Code and GitHub Codespaces only feature.
- Currently being standardized.
- Other vendors are looking to adopt.
- Flakey containers if running on arch64 (Example: Apple Silicon).
- Software is still transitioning.
- This is more of a Docker issue than a
dev container
issue. -
🚨 I picked this stack for this project as it currently is one of those flakey containers and I want to show what to do when things go wrong.
- Be sure above software is downloaded and configured.
- Delete any containers, images, and volumes associated with this repo prior to presentation.
- Starting out, no images, container, or volumes exist for this project.
- Cloning this project with Dev Container.
- Show
.devcontainer
directory.
- Show
- "Open in Container" icon and prompt.
- Startup Log
- Terminal (In Container vs Host OS)
- Configuration
.devcontainer.json
Dockerfile
- Extensions:
- SQL (Configured)
- Show Postgres connection, but no db.
- Adding new extensions to
.devcontainer.json
via extension panel.- Search for
vscode-pets
.
- Search for
- SQL (Configured)
- Migrations
- Run via Terminal
cd backend
sqlx migrate run
- Show in Extension
- Run via Terminal
- Mapped Ports
- Start project:
cd backend
cargo build
cargo run
-
🚨 I know
cargo run
does a build, but this is working around one of the flakey issues in this container.
-
- Show access via host:
- http://localhost:3000
-
🚨 Notice database connectivity.
- Data will persist via container volume, even if container is destroyed.
- Start project:
- Show how to make a node.js dev container.
- Use newer version than local.
- Show differences in terminal.
- Example code:
console.log("Hello, Dev Container");
- Quick Overview of Project
- Mapped Environment Variables