|
| 1 | +# Sim Studio Development Container |
| 2 | + |
| 3 | +This directory contains configuration files for Visual Studio Code Dev Containers / GitHub Codespaces. Dev containers provide a consistent, isolated development environment for this project. |
| 4 | + |
| 5 | +## Contents |
| 6 | + |
| 7 | +- `devcontainer.json` - The main configuration file that defines the development container settings |
| 8 | +- `Dockerfile` - Defines the container image and development environment |
| 9 | +- `docker-compose.yml` - Sets up the application and database containers |
| 10 | +- `post-create.sh` - Script that runs when the container is created |
| 11 | +- `.bashrc` - Custom shell configuration with helpful aliases |
| 12 | + |
| 13 | +## Usage |
| 14 | + |
| 15 | +### Prerequisites |
| 16 | + |
| 17 | +- Visual Studio Code |
| 18 | +- Docker installation: |
| 19 | + - Docker Desktop (Windows/macOS) |
| 20 | + - Docker Engine (Linux) |
| 21 | +- VS Code Remote - Containers extension |
| 22 | + |
| 23 | +### Getting Started |
| 24 | + |
| 25 | +1. Open this project in Visual Studio Code |
| 26 | +2. When prompted, click "Reopen in Container" |
| 27 | + - Alternatively, press `F1` and select "Remote-Containers: Reopen in Container" |
| 28 | +3. Wait for the container to build and initialize |
| 29 | +4. The post-creation script will automatically: |
| 30 | + |
| 31 | + - Install dependencies |
| 32 | + - Set up environment variables |
| 33 | + - Run database migrations |
| 34 | + - Configure helpful aliases |
| 35 | + |
| 36 | +5. Start the application with `sim-start` (alias for `npm run dev`) |
| 37 | + |
| 38 | +### Development Commands |
| 39 | + |
| 40 | +The development environment includes these helpful aliases: |
| 41 | + |
| 42 | +- `sim-start` - Start the development server |
| 43 | +- `sim-migrate` - Push schema changes to the database |
| 44 | +- `sim-generate` - Generate new migrations |
| 45 | +- `sim-rebuild` - Build and start the production version |
| 46 | +- `pgc` - Connect to the PostgreSQL database |
| 47 | +- `check-db` - List all databases |
| 48 | + |
| 49 | +### Using GitHub Codespaces |
| 50 | + |
| 51 | +This project is also configured for GitHub Codespaces. To use it: |
| 52 | + |
| 53 | +1. Go to the GitHub repository |
| 54 | +2. Click the "Code" button |
| 55 | +3. Select the "Codespaces" tab |
| 56 | +4. Click "Create codespace on main" |
| 57 | + |
| 58 | +This will start a new Codespace with the development environment already set up. |
| 59 | + |
| 60 | +## Customization |
| 61 | + |
| 62 | +You can customize the development environment by: |
| 63 | + |
| 64 | +- Modifying `devcontainer.json` to add VS Code extensions or settings |
| 65 | +- Updating the `Dockerfile` to install additional packages |
| 66 | +- Editing `docker-compose.yml` to add services or change configuration |
| 67 | +- Modifying `.bashrc` to add custom aliases or configurations |
| 68 | + |
| 69 | +## Troubleshooting |
| 70 | + |
| 71 | +If you encounter issues: |
| 72 | + |
| 73 | +1. Rebuild the container: `F1` → "Remote-Containers: Rebuild Container" |
| 74 | +2. Check Docker logs for build errors |
| 75 | +3. Verify Docker Desktop is running |
| 76 | +4. Ensure all prerequisites are installed |
| 77 | + |
| 78 | +For more information, see the [VS Code Remote Development documentation](https://code.visualstudio.com/docs/remote/containers). |
0 commit comments