devbox
※ WSLでの起動を確認しています
- devbox起動
devbox shell
- サービス起動
devbox services up
- サービス起動バックグラウンド
devbox services up -b
- サービス停止
devbox services stop
- mongodb cli
mongosh
- mongodb接続文字列
mongodb://127.0.0.1:27017/
devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.0/.schema/devbox.schema.json",
"packages": [
"mongodb-ce@latest",
"azurite@latest",
"nodejs@20",
"mongosh@latest",
"mongodb-compass@latest"
],
"shell": {
"init_hook": ["echo 'Welcome to devbox!' > /dev/null"],
"scripts": {
"test": ["echo \"Error: no test specified\" && exit 1"]
}
}
}
process-compose.yml
version: '1.0'
processes:
azurite-blob:
command: azurite-blob --blobHost 0.0.0.0 --blobPort 10000
ports:
- "10000:10000"
volumes:
- ./azurite:/data
azurite-table:
command: azurite-table --tableHost 0.0.0.0 --tablePort 10002
ports:
- "10002:10002"
volumes:
- ./azurite:/data
mongodb:
command: mongod --bind_ip 0.0.0.0 --port 27017 --dbpath ./db
ports:
- "27017:27017"
mongodb-compass:
command: mongodb-compass
ports:
- "27018:27018"
environment:
- DISPLAY=${DISPLAY}
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
devcontainerでdevboxを起動する
.devcontainer/Dockerfile
ARG version="0.14.0"
FROM jetpackio/devbox:${version}
# Installing your devbox project
WORKDIR /workspaces
USER root:root
RUN mkdir -p /workspaces
RUN chown ${DEVBOX_USER}:${DEVBOX_USER} /workspaces
USER ${DEVBOX_USER}:${DEVBOX_USER}
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.json devbox.json
COPY --chown=${DEVBOX_USER}:${DEVBOX_USER} devbox.lock devbox.lock
RUN devbox run -- echo "Installed Packages."
RUN devbox shellenv --init-hook >> ~/.profile
.devcontainer/devcontainer.json
{
"name": "Devbox Remote Container",
"build": {
"dockerfile": "./Dockerfile",
"context": ".."
},
"workspaceFolder": "/workspaces/",
"features": {
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {},
"ghcr.io/devcontainers/features/git:1": {}
},
"customizations": {
"vscode": {
"settings": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"[typescript]": {
"editor.formatOnSave": true
},
"[typescriptreact]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always",
"source.fixAll": "always",
"source.organizeImports": "always",
"quickFix.biome": "always",
"source.organizeImports.biome": "always"
},
"cSpell.words": [],
"codemetrics.nodeconfiguration.JsxSelfClosingElement": 0
},
"extensions": [
"jetpack-io.devbox",
"biomejs.biome"
]
}
},
"remoteUser": "devbox"
}