|
| 1 | +# Frontend Dev Container |
| 2 | + |
| 3 | +This dev container provides a complete Node.js development environment for the Outline Config Server frontend. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Node.js 22 with TypeScript (using official Microsoft dev container image) |
| 8 | +- npm and yarn pre-installed |
| 9 | +- Essential VS Code extensions for React/TypeScript/Vite development |
| 10 | +- Git and GitHub CLI pre-installed |
| 11 | +- All dependencies managed by the official image |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +### Opening in Dev Container |
| 16 | + |
| 17 | +1. **Using VS Code:** |
| 18 | + - Open the `frontend` folder in VS Code |
| 19 | + - Press `F1` or `Ctrl+Shift+P` (or `Cmd+Shift+P` on Mac) |
| 20 | + - Select "Dev Containers: Reopen in Container" |
| 21 | + - Wait for the container to build and initialize |
| 22 | + |
| 23 | +2. **Using VS Code Remote Containers:** |
| 24 | + - Click the green button in the bottom-left corner |
| 25 | + - Select "Reopen in Container" |
| 26 | + |
| 27 | +### Running the Application |
| 28 | + |
| 29 | +Once inside the container: |
| 30 | + |
| 31 | +```bash |
| 32 | +# Start the development server |
| 33 | +npm run dev |
| 34 | + |
| 35 | +# Build for production |
| 36 | +npm run build |
| 37 | + |
| 38 | +# Preview production build |
| 39 | +npm run preview |
| 40 | + |
| 41 | +# Run linting |
| 42 | +npm run lint |
| 43 | + |
| 44 | +# Run Cypress tests (E2E) |
| 45 | +npm run test-e2e |
| 46 | + |
| 47 | +# Run Cypress tests (Component) |
| 48 | +npm run test-component |
| 49 | +``` |
| 50 | + |
| 51 | +### Accessing the Application |
| 52 | + |
| 53 | +- Development server: http://localhost:5173 |
| 54 | +- Preview server: http://localhost:4173 |
| 55 | + |
| 56 | +## Volumes |
| 57 | + |
| 58 | +The dev container mounts: |
| 59 | +- `frontend` folder → `/workspaces/frontend` (your source code with cached consistency) |
| 60 | + |
| 61 | +## Environment Variables |
| 62 | + |
| 63 | +The container sets: |
| 64 | +- `NODE_ENV=development` |
| 65 | +- `CHOKIDAR_USEPOLLING=true` (for file watching in containers) |
| 66 | + |
| 67 | +## Customization |
| 68 | + |
| 69 | +Edit `.devcontainer/devcontainer.json` to: |
| 70 | +- Add more VS Code extensions |
| 71 | +- Change port mappings |
| 72 | +- Add environment variables |
| 73 | +- Add post-create commands |
| 74 | +- Add dev container features (e.g., Docker-in-Docker, Python, etc.) |
| 75 | + |
| 76 | +## Notes |
| 77 | + |
| 78 | +- File changes are automatically detected and trigger hot reload |
| 79 | +- If you need Cypress for E2E testing, it will be installed via `npm install` |
| 80 | +- The cached consistency mount provides good performance for file operations |
0 commit comments