feat: add devcontainer setup (#61695)

This commit is contained in:
Mrugesh Mohapatra
2025-08-07 01:34:30 +05:30
committed by GitHub
parent 58fed4ae4f
commit 8b33e316ab
2 changed files with 39 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
{
"name": "freeCodeCampDC",
"dockerComposeFile": "docker-compose.yml",
"service": "devcontainer",
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
// "features": {},
"forwardPorts": [3000, 8000]
}
+31
View File
@@ -0,0 +1,31 @@
services:
devcontainer:
depends_on:
- mongo-db
- mongo-setup
image: mcr.microsoft.com/devcontainers/typescript-node:22
volumes:
- ../..:/workspaces:cached
network_mode: service:mongo-db
command: sleep infinity
mongo-db:
image: mongo
command: mongod --replSet rs0
restart: unless-stopped
volumes:
- mongodb-data:/data/db
mongo-setup:
image: mongo
depends_on:
- mongo-db
restart: on-failure
entrypoint: [
'bash',
'-c',
# This will try to initiate the replica set, until it succeeds twice (i.e. until the replica set is already initialized)
'mongosh --host mongo-db:27017 --eval ''try {rs.initiate();} catch (err) { if(err.codeName !== "AlreadyInitialized") throw err };'''
]
volumes:
mongodb-data: