97 lines
3.4 KiB
JSON
97 lines
3.4 KiB
JSON
{
|
|
// ============================================================================
|
|
// VS CODE DEV CONTAINER CONFIGURATION
|
|
// ============================================================================
|
|
// This file configures VS Code's Dev Containers extension to provide a
|
|
// consistent, fully-configured development environment.
|
|
//
|
|
// Features:
|
|
// - Automatic PostgreSQL + Redis startup with healthchecks
|
|
// - Automatic npm install
|
|
// - Automatic database schema initialization and seeding
|
|
// - Pre-configured VS Code extensions (ESLint, Prettier)
|
|
// - Podman support for Windows users
|
|
//
|
|
// Usage:
|
|
// 1. Install the "Dev Containers" extension in VS Code
|
|
// 2. Open this project folder
|
|
// 3. Click "Reopen in Container" when prompted (or use Command Palette)
|
|
// 4. Wait for container build and initialization
|
|
// 5. Development server starts automatically
|
|
// ============================================================================
|
|
|
|
"name": "Flyer Crawler Dev (Ubuntu 22.04)",
|
|
|
|
// Use Docker Compose for multi-container setup
|
|
"dockerComposeFile": ["../compose.dev.yml"],
|
|
"service": "app",
|
|
"workspaceFolder": "/app",
|
|
|
|
// VS Code customizations
|
|
"customizations": {
|
|
"vscode": {
|
|
"extensions": [
|
|
// Code quality
|
|
"dbaeumer.vscode-eslint",
|
|
"esbenp.prettier-vscode",
|
|
// TypeScript
|
|
"ms-vscode.vscode-typescript-next",
|
|
// Database
|
|
"mtxr.sqltools",
|
|
"mtxr.sqltools-driver-pg",
|
|
// Utilities
|
|
"eamodio.gitlens",
|
|
"streetsidesoftware.code-spell-checker"
|
|
],
|
|
"settings": {
|
|
"editor.formatOnSave": true,
|
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
"typescript.preferences.importModuleSpecifier": "relative"
|
|
}
|
|
}
|
|
},
|
|
|
|
// Run as root (required for npm global installs)
|
|
"remoteUser": "root",
|
|
|
|
// ============================================================================
|
|
// Lifecycle Commands
|
|
// ============================================================================
|
|
|
|
// initializeCommand: Runs on the HOST before the container is created.
|
|
// Starts Podman machine on Windows (no-op if already running or using Docker).
|
|
"initializeCommand": "powershell -Command \"podman machine start; exit 0\"",
|
|
|
|
// postCreateCommand: Runs ONCE when the container is first created.
|
|
// This is where we do full initialization: npm install + database setup.
|
|
"postCreateCommand": "chmod +x scripts/docker-init.sh && ./scripts/docker-init.sh",
|
|
|
|
// postAttachCommand: Runs EVERY TIME VS Code attaches to the container.
|
|
// Starts the development server automatically.
|
|
"postAttachCommand": "npm run dev:container",
|
|
|
|
// ============================================================================
|
|
// Port Forwarding
|
|
// ============================================================================
|
|
// Automatically forward these ports from the container to the host
|
|
"forwardPorts": [3000, 3001],
|
|
|
|
// Labels for forwarded ports in VS Code's Ports panel
|
|
"portsAttributes": {
|
|
"3000": {
|
|
"label": "Frontend (Vite)",
|
|
"onAutoForward": "notify"
|
|
},
|
|
"3001": {
|
|
"label": "Backend API",
|
|
"onAutoForward": "notify"
|
|
}
|
|
},
|
|
|
|
// ============================================================================
|
|
// Features
|
|
// ============================================================================
|
|
// Additional dev container features (optional)
|
|
"features": {}
|
|
}
|