Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# act configuration for local workflow testing
# Usage: act -j build-and-push

# Use medium Ubuntu runner image for better compatibility
-P ubuntu-latest=catthehacker/ubuntu:act-latest

# Enable verbose output
--verbose

# Container options
--container-options "--platform linux/amd64"

65 changes: 65 additions & 0 deletions .cursor/rules/adding-new-images.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
alwaysApply: true
---
# Adding New Docker Images

## Workflow

1. **Create Dockerfile** - Write and refine the Dockerfile
2. **Build Locally** - Build and test the image thoroughly
3. **Create Workflow** - Add GitHub Actions workflow for CI/CD
4. **Generate Documentation** - Only after successful build, create README

## Directory Structure

Create new directory: `images/<image-name>/` containing:
- `Dockerfile` - Image definition
- `README.md` - Comprehensive documentation
- Supporting files as needed

## Dockerfile Requirements

- Base image with version
- Build arguments for version pinning
- Environment variables for tool paths
- Working directory `/workspace`
- Verification step
- Layer optimization (combine RUN commands, cleanup)

## README Requirements

Image README must include:
- Overview and description
- What's Inside (specific versions)
- Quick Start (pull, build, run)
- Usage Examples
- CI/CD Integration examples
- Environment Variables
- Building the Image

- Version Information table

## Update Root README

Add new image to the table in root README. Keep it minimal - just image name, brief description, and link.

## Registry Naming

Images published as: `ghcr.io/jethome-iot/jethome-dev-<image-name>`

## GitHub Actions Workflow

Create `.github/workflows/<image-name>.yml`:
- Use reusable workflow: `.github/workflows/reusable-docker-build.yml`
- Set triggers for image directory and workflow file changes
- Pass `image_name` and `context_path` parameters
- Include manual trigger and monthly rebuild schedule
- Test locally with `act -j build -W .github/workflows/<image-name>.yml --dryrun`

## Testing

Before committing:
- Build Docker image locally and verify functionality
- Test workflow with `act` in dry-run mode
- Test all README examples
- Check image size is reasonable
45 changes: 45 additions & 0 deletions .cursor/rules/commit-conventions.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
alwaysApply: true
---
# Git Commit Conventions

## Commit Message Format

Use clear, descriptive commit messages that explain **what** and **why**.

```
<Brief summary line>

- Detailed point 1
- Detailed point 2
- Detailed point 3
```

Good: `Add new development image` with detailed list
Bad: `Update files`, `Fix`, `WIP`, `changes`

## AI/Cursor Commit Policy

**🚫 NEVER AUTO-COMMIT**

- AI assistants must NEVER commit changes automatically
- AI assistants must NEVER use `git commit` without explicit user confirmation
- Only the USER decides when to commit
- USER must review and approve all commits

## Branch Strategy

- **dev** - Development work, testing
- **master** - Stable releases only
- Feature branches - For experimental work

## Commit Grouping

Group related changes in single commit:
- Dockerfile + README for same feature
- All files needed for new image

Keep separate:
- Don't mix unrelated changes
- Don't combine feature + bugfix
- Don't combine multiple images in one commit
38 changes: 38 additions & 0 deletions .cursor/rules/dockerfile-standards.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
alwaysApply: true
---
# Dockerfile Standards

## General Guidelines

### Base Image
- Use slim variants to minimize image size
- Pin versions
- Document base image choice in README

### Build Arguments
- Use `ARG` for version pinning
- Provide sensible defaults
- Document all build args in README

### Environment Variables
- Centralize tool directories
- Set all relevant `ENV` variables at image level
- Document in README

### Layer Optimization
- Combine `RUN` commands where logical
- Clean up in same layer (`apt-get clean`, `rm -rf`)
- Use `--no-cache-dir` for pip installs

### Working Directory
- Set to `/workspace` for user projects
- Mount user code here as volume

### Verification
- Add verification `RUN` at end to check installations

### CI/CD Focus
- Optimize for automated builds
- Keep images small - don't pre-download large toolchains unless necessary
- Let frameworks download on first build (toolchains cache in volumes)
46 changes: 46 additions & 0 deletions .cursor/rules/documentation-standards.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
alwaysApply: true
---
# Documentation Standards

## Root README

Must be:
- **Generic**: Suitable for multi-image architecture
- **Minimal**: Brief overview, not detailed
- **Scalable**: Easy to add new images

Structure:
1. Brief project description
2. Table of current images with links
3. Generic quick start
4. Project structure diagram
5. Registry information
6. License

## Image READMEs

Must be:
- **Comprehensive**: All details about the image
- **Accurate**: No misleading claims
- **Practical**: Real-world usage examples

Required sections:
1. Overview
2. What's Inside (specific versions)
3. Quick Start
4. Usage Examples
5. Environment Variables
6. Building the Image
7. Version Information table

Sections to AVOID:
- Troubleshooting (users can refer to upstream documentation)
- Design Decisions (keep documentation focused on usage)

## Accuracy Rules

- Only document what's actually in the Dockerfile
- Clearly state what downloads at runtime vs pre-installed
- Include actual version numbers
- Never claim features that aren't implemented
45 changes: 45 additions & 0 deletions .cursor/rules/github-actions-standards.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
alwaysApply: true
---
# GitHub Actions Standards

## Workflow Naming

Use emoji icons for better visibility:

```yaml
name: 🐳 Docker Build Workflow
```

Common icons:
- 🐳 Docker builds
- 🔧 Build/compile
- 🧪 Testing
- 📦 Package/release
- 🚀 Deployment

## Step Icons

Add emoji to step names for readability:

- 📥 Checkout code
- 🔧 Setup/configure tools
- 🔐 Authentication
- 🐳 Docker operations
- 🧪 Run tests
- 🚀 Deploy

## Per-Image Workflows

Each image should have its own workflow file:
- Naming: `.github/workflows/<image-name>.yml`
- Trigger on relevant file changes only
- Use branch-based tagging (dev, latest, stable)
- Use reusable workflow: `.github/workflows/reusable-docker-build.yml`

## Local Testing

Test workflows locally using `act`:
- Configuration in `.actrc`
- Test specific job: `act -j build`
- Use `.secrets` file for local secrets (gitignored)
37 changes: 37 additions & 0 deletions .cursor/rules/project-structure.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
alwaysApply: true
---
# JetHome Development Environment - Project Structure

Multi-image Docker project providing development environments for embedded systems.

## Repository Structure

```
jethome-dev/
├── images/
│ └── <image-name>/ # Each image in its own directory
│ ├── Dockerfile # Image definition
│ ├── README.md # Detailed image documentation
│ └── ... # Supporting files
├── .cursor/rules/ # Cursor AI rules
├── LICENSE # MIT License
└── README.md # Root README (minimal, generic)
```

## Key Principles

1. **Root README**: Keep minimal and generic - overview for multiple images
2. **Image READMEs**: Comprehensive and detailed - all specifics go here
3. **One image per directory**: Each in `images/<image-name>/`
4. **Self-contained**: Each image directory contains everything needed to build it

## Registry

Images published to GitHub Container Registry (GHCR):
- Format: `ghcr.io/jethome-iot/jethome-dev-<image-name>`

## Branch Strategy

- `dev` - Development branch
- `master` - Stable releases
80 changes: 80 additions & 0 deletions .github/workflows/esp-idf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# ESP-IDF Docker Build Workflow
name: 🐳 ESP-IDF Docker Image

env:
ESP_IDF_VERSION: v5.4.1

on:
push:
branches: [master, dev]
paths:
- '.github/workflows/esp-idf.yml'
- '.github/workflows/reusable-docker-build.yml'
- 'images/esp-idf/**'
pull_request:
branches: [master, dev]
paths:
- '.github/workflows/esp-idf.yml'
- '.github/workflows/reusable-docker-build.yml'
- 'images/esp-idf/**'
# Manual trigger
workflow_dispatch:
inputs:
esp_idf_version:
description: 'ESP-IDF version (e.g., v5.4.1, v5.3.1)'
required: false
default: 'v5.4.1'
type: string
force_rebuild:
description: 'Force rebuild without cache'
required: false
default: false
type: boolean
custom_tags:
description: 'Additional custom tags (comma-separated, optional)'
required: false
default: ''
type: string

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
esp_idf_version: ${{ steps.prepare.outputs.esp_idf_version }}
custom_tags: ${{ steps.prepare.outputs.custom_tags }}
steps:
- name: 🏷️ Prepare ESP-IDF version and tags
id: prepare
run: |
ESP_IDF_VERSION="${{ github.event.inputs.esp_idf_version || env.ESP_IDF_VERSION }}"
CUSTOM_TAGS="${{ github.event.inputs.custom_tags || '' }}"

# Add ESP-IDF version tag only on master branch
if [ "${{ github.ref_name }}" == "master" ]; then
if [ -n "$CUSTOM_TAGS" ]; then
TAGS="${CUSTOM_TAGS},${ESP_IDF_VERSION}"
else
TAGS="${ESP_IDF_VERSION}"
fi
else
TAGS="${CUSTOM_TAGS}"
fi

echo "esp_idf_version=${ESP_IDF_VERSION}" >> $GITHUB_OUTPUT
echo "custom_tags=${TAGS}" >> $GITHUB_OUTPUT

build:
needs: prepare
uses: ./.github/workflows/reusable-docker-build.yml
permissions:
contents: read
packages: write
id-token: write
with:
image_name: jethome-dev-esp-idf
context_path: images/esp-idf
force_rebuild: ${{ github.event.inputs.force_rebuild || false }}
custom_tags: ${{ needs.prepare.outputs.custom_tags }}
build_args: |
ESP_IDF_VERSION=${{ needs.prepare.outputs.esp_idf_version }}

Loading
Loading