mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat: add devcontainer setup (#61695)
This commit is contained in:
committed by
GitHub
parent
58fed4ae4f
commit
8b33e316ab
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "freeCodeCampDC",
|
||||
"dockerComposeFile": "docker-compose.yml",
|
||||
"service": "devcontainer",
|
||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||
// "features": {},
|
||||
"forwardPorts": [3000, 8000]
|
||||
}
|
||||
@@ -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:
|
||||
Reference in New Issue
Block a user