add dev container for remote dev

This commit is contained in:
2026-06-14 18:47:43 -05:00
parent 1606d9d014
commit 675118faea
4 changed files with 137 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm
+46
View File
@@ -0,0 +1,46 @@
{
"name": "Storage Manager",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspaces/storage-manager",
"remoteUser": "node",
"mounts": [
"type=bind,source=${localEnv:HOME}/.codex,target=/home/node/.codex"
],
"forwardPorts": [5173, 5000, 8999, 27017],
"portsAttributes": {
"5173": {
"label": "Vite frontend",
"onAutoForward": "notify"
},
"5000": {
"label": "Express API",
"onAutoForward": "notify"
},
"8999": {
"label": "Mongo Express",
"onAutoForward": "silent"
},
"27017": {
"label": "MongoDB",
"onAutoForward": "silent"
}
},
"postCreateCommand": "cd server && npm ci && cd ../client && npm ci",
"customizations": {
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "bash",
"editor.formatOnSave": true,
"files.eol": "\n"
},
"extensions": [
"openai.chatgpt",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"ms-azuretools.vscode-docker",
"mongodb.mongodb-vscode"
]
}
}
}
+55
View File
@@ -0,0 +1,55 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
command: sleep infinity
environment:
DB_HOST: mongo
DB_PORT: 27017
DB_USERNAME: devroot
DB_PASSWORD: devroot
PORT: 5000
VITE_API_HOST: localhost
VITE_API_PORT: 5000
VITE_API_PROTOCOL: http
networks:
- mongo-network
volumes:
- ..:/workspaces/storage-manager:cached
depends_on:
- mongo
mongo:
image: mongo:4.4.6
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: devroot
MONGO_INITDB_ROOT_PASSWORD: devroot
networks:
- mongo-network
ports:
- "27017:27017"
volumes:
- mongo-data:/data/db
mongo-express:
image: mongo-express
restart: unless-stopped
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: devroot
ME_CONFIG_MONGODB_ADMINPASSWORD: devroot
ME_CONFIG_MONGODB_URL: mongodb://devroot:devroot@mongo:27017/
ME_CONFIG_BASICAUTH: "false"
networks:
- mongo-network
ports:
- "8999:8081"
depends_on:
- mongo
networks:
mongo-network:
volumes:
mongo-data:
+35 -1
View File
@@ -16,6 +16,40 @@ This project is supposed to make finding objects inside boxes easier. Translucen
- TailwindCSS
## Dev Environment
### Dev Container
This repo includes a VS Code dev container, modeled after the setup in `plant-man`.
- Prerequisite: Docker Desktop with the Docker CLI available.
- In VS Code, run `Dev Containers: Reopen in Container`.
- The container installs dependencies in both `server/` and `client/`.
- MongoDB starts as a sidecar service using the default dev credentials below:
```env
DB_HOST=mongo
DB_PORT=27017
DB_USERNAME=devroot
DB_PASSWORD=devroot
PORT=5000
```
Start the app from two terminals inside the container:
```sh
cd server
npm run start
```
```sh
cd client
npm run dev
```
Forwarded services:
- Client: http://localhost:5173
- API: http://localhost:5000
- Mongo Express: http://localhost:8999
- MongoDB: localhost:27017
### Database
Located in `database` directory. Configured to use Mongo DB Docker container `mongo-db`. Included is a `docker-compose.yml` file that will host a Mongo DB on port `27017` using credentials configured with environment variables, e.g:
@@ -51,4 +85,4 @@ Located in `client/` directory.
- `npm i`
- Uses `vite` build and dev server, `npm run dev`
---
---