chore: remove devcontainer configuration and related scripts

This commit is contained in:
Peter Wood
2025-05-23 07:27:39 -04:00
parent d0486671cb
commit 802650510c
10 changed files with 52 additions and 595 deletions

View File

@@ -4,9 +4,9 @@
- Windows, macOS, or Linux
- Git
- Docker Desktop
- Visual Studio Code with Remote - Containers extension
- GitHub CLI
- Node.js (version 18 or higher)
- npm or yarn
- PostgreSQL (local installation or Docker)
## Initial Setup
@@ -16,81 +16,31 @@
cd finance
```
2. **Create Environment Files**
2. **Install Dependencies**
```bash
npm install
```
3. **Create Environment File**
```bash
cp .devcontainer/.env.example .devcontainer/.env
cp .env.example .env
```
## GitHub Personal Access Token (PAT)
4. **Configure Database**
- Edit the `.env` file with your PostgreSQL connection string:
```
DATABASE_URL="postgresql://username:password@localhost:5432/finance"
```
1. **Create a new PAT:**
- Go to GitHub Settings > Developer settings > Personal access tokens > Tokens (classic)
- Click "Generate new token (classic)"
- Name: `finance-dev-token`
- Set expiration: 90 days (recommended)
- Required scopes:
- `repo` (Full control of private repositories)
- `read:packages` (Download container images)
- `write:packages` (Upload container images)
- `delete:packages` (Optional: manage container versions)
- `workflow` (GitHub Actions integration)
2. **Configure the PAT:**
- Open `.devcontainer/.env`
- Set `GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here`
## Building the Development Container
### Using VS Code (Recommended)
1. Open the project in VS Code
2. When prompted, click "Reopen in Container"
- Or press F1 and run "Dev Containers: Rebuild and Reopen in Container"
### Using Command Line
1. Install the devcontainer CLI:
5. **Set up Database**
```bash
npm install -g @devcontainers/cli
# Run database migrations
npx prisma migrate dev
# Seed the database with initial data (optional)
npx prisma db seed
```
2. Build the container:
```bash
devcontainer build .
```
3. Start the container:
```bash
# With post-create command
devcontainer up --workspace-folder .
# Skip post-create command
devcontainer up --workspace-folder . --skip-post-create
```
## Building and Pushing the Container Image
1. Ensure you're in the `.devcontainer` directory
2. Choose your preferred script:
**Using PowerShell:**
```powershell
.\build-and-push.ps1 your_github_username
```
**Using Git Bash/Unix Shell:**
```bash
chmod +x build-and-push.sh
./build-and-push.sh your_github_username
```
Both scripts perform the same functions:
- Validate prerequisites (Docker, GitHub CLI)
- Load GitHub PAT from `.env` file
- Build the container image
- Push to GitHub Container Registry
- Provide next steps for using the image
## Git Hooks
This project uses Git hooks via Husky to enforce code quality:
@@ -140,63 +90,29 @@ For hook execution issues:
npm run prepare
```
## Environment Files
## Environment Configuration
The project uses two separate environment files:
The project uses an `.env` file for configuration:
1. `.devcontainer/.env`:
- Container-specific configuration
- GitHub PAT
- PostgreSQL settings
- pgAdmin settings
2. `.env`:
- Application-specific configuration
- Development server port
- API base URL
- Node environment
- Application-specific configuration
- Database connection string
- Development server port
- API base URL
- Node environment
## Troubleshooting
### Container Build Issues
- Ensure Docker Desktop is running
- Check that your PAT has the correct permissions
- Try rebuilding without cache: `devcontainer build . --no-cache`
### Database Issues
- Ensure PostgreSQL is running
- Check that your database connection string is correct in `.env`
- Try resetting the database: `npx prisma migrate reset`
### GitHub Authentication Issues
- Verify your PAT in `.devcontainer/.env`
- Try logging in manually: `gh auth login`
- Check GitHub CLI status: `gh auth status`
### Build Issues
- Clear node_modules and reinstall: `Remove-Item -Recurse -Force node_modules; npm install`
- Check that all environment variables are set correctly
- Ensure you have the correct Node.js version installed
### Network Issues
- If DNS resolution fails, try using different DNS servers in `devcontainer.json`
- Check if GitHub Container Registry (ghcr.io) is accessible
- Verify Docker network settings
### VS Code Issues
- Install/update the Remote - Containers extension
- Clear VS Code's container cache
- Check VS Code's "Dev Containers" output panel for detailed logs
## Common Operations
### Rebuilding the Container
```bash
# Using VS Code
F1 -> "Dev Containers: Rebuild Container"
# Using CLI
devcontainer build . --no-cache
```
### Updating the Container Image
1. Make changes to `Dockerfile` or `devcontainer.json`
2. Run the build script:
```bash
./build-and-push.sh your_github_username
```
3. Update image reference in `devcontainer.json`
4. Rebuild container in VS Code
### Common Operations
### Starting Development Server
```bash