Proven tips and workflows to get the most out of remote workspaces in Factory
Practice | Why it matters | How to do it |
---|---|---|
Start from the right image | Lean images build faster and consume fewer resources. | Choose the closest official image (e.g., javascript-node:20 ) and layer tools on top. |
Cache heavy tooling | Re-downloading large packages slows rebuilds. | Move expensive installs (e.g., Chrome, large SDKs) to the image stage instead of postCreateCommand . |
Shrink build context | Huge contexts = slow uploads. | Add **/node_modules , build artifacts, and secrets to .dockerignore . |
Forward only needed ports | Too many ports clutter the UI. | Keep forwardPorts to the handful you actually use. |
Tip: Test locally with the Dev Containers CLI (devcontainer up
) before committing.
git checkout -b feature/workspace-improvements
.git pull --rebase origin main
keeps your branch up-to-date without noisy merge commits.Spin-Up-Per-Task
Shared Review Environments
Parallel Environments
Tip | Details |
---|---|
Name workspaces clearly | Use service-purpose-branch (e.g., api-auth-refactor ) so teammates know what’s running. |
Document entry commands | Add a README_REMOTE_WORKSPACE.md with common tasks (npm run dev , pytest )—new hires onboard instantly. |
Symptom | Resolution |
---|---|
Rebuild is slow | Verify .dockerignore , cache heavy installs in image, use lighter base. |
Git asks for credentials | Ensure repository integration is enabled in Integrations → Repositories. |
Out-of-disk errors | Prune package caches (npm cache clean --force ) or rebuild workspace. |