Best Practices for Remote Workspaces
Proven tips and workflows to get the most out of remote workspaces in Factory
Remote workspaces let you spin up consistent, production-ready development environments in seconds. Below are field-tested practices that keep workspaces fast, predictable, and team-friendly.
1. Optimize Your Devcontainer
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.
2. Git Workflows Inside a Remote Workspace
Branch Fast
Create feature branches as you would locally:
git checkout -b feature/workspace-improvements
Commit Often
Short commit cycles reduce merge pain and keep your workspace snapshot small.
Push via HTTPS
Remote credentials are injected automatically—no need to copy SSH keys.
Use Rebase for Clean History
git pull —rebase origin mainkeeps your branch up-to-date without noisy merge commits.
Remember: everything you do in a remote workspace happens inside the cloud environment. Your local machine stays untouched until you pull changes down.
3. Workflow Patterns That Scale
4. Team Collaboration Tips
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. |
5. Troubleshooting at a Glance
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. |
Quick Checklist Before Merging Code
- All tests pass inside remote workspace
- Linter is green
- Devcontainer changes committed
- Workspace hibernated or archived
Following these practices keeps your remote workspaces fast, secure, and collaborative—so you can focus on shipping code, not configuring machines.