Skip to content

Boothfile#9

Merged
NawaMan merged 11 commits intomainfrom
feature/Boothfile
Feb 5, 2026
Merged

Boothfile#9
NawaMan merged 11 commits intomainfrom
feature/Boothfile

Conversation

@NawaMan
Copy link
Owner

@NawaMan NawaMan commented Feb 4, 2026

No description provided.

Implement the core parser for Boothfile DSL that:
- Validates # syntax=codingbooth/boothfile:1 header
- Parses all Phase 1-3 commands (run, copy, env, setup, install, etc.)
- Supports heredoc syntax with three modes (verbatim, &&-join, ;-join)
- Handles comments (full-line and inline)
- Provides error messages with line numbers and suggestions
- Includes DOCKER escape hatch for unsupported directives
Implement the compiler that converts parsed Boothfile commands to Dockerfile:
- Generate fixed CodingBooth prologue (syntax, ARG, FROM, SHELL, USER, WORKDIR)
- Compile all Phase 1 commands (run, copy, env, workdir, expose, label, arg)
- Compile heredoc with three modes (verbatim, &&-join, ;-join)
- Compile Phase 2 setup command (setup python 3.12 -> RUN python--setup.sh 3.12)
- Compile Phase 3 install command (install pip django -> RUN pip--install.sh django)
- Support custom setup script detection with automatic COPY injection
- Handle DOCKER escape hatch (pass-through to Dockerfile)
Integrate Boothfile compiler into the booth CLI:
- Add --boothfile flag to specify Boothfile path
- Add --emit-dockerfile flag to output generated Dockerfile without building
- Add --strict flag to treat warnings as errors
- Add Boothfile/EmitDockerfile/Strict fields to AppConfig with env vars
- Auto-detect .booth/Boothfile (takes precedence over .booth/Dockerfile)
- Compile Boothfile to .booth/.Dockerfile.generated for Docker build
- Support custom setup script detection from .booth/setups/

File selection precedence:
1. --dockerfile (explicit) - use directly
2. --boothfile (explicit) - compile and use
3. .booth/Boothfile (auto-detect) - compile and use
4. .booth/Dockerfile (auto-detect) - use directly
Test full parse->compile pipeline with realistic scenarios:
- Django/Python project Boothfile
- Java/Maven project Boothfile
- Node.js project Boothfile
- Data science environment with scientific stack
- Go microservices environment

Test heredoc modes:
- Verbatim mode for complex shell scripts
- And-join mode (&&) for package installation
- Semi-join mode (;) for optional commands

Test edge cases:
- Custom setup script detection
- Error recovery and multiple error reporting
- Empty Boothfile, comments-only Boothfile
- Long command lines, special characters
Update docs/plans/Boothfile.md:
- Add heredoc mode selection (verbatim, &&-join, ;-join)
- Add arg variable usage with naming conventions
- Update examples for new heredoc syntax

Update README.md:
- Add Boothfile to Table of Contents
- Add new CLI flags (--boothfile, --emit-dockerfile, --strict)
- Update .booth/ folder structure with Boothfile and setups/
- Add comprehensive Boothfile section with:
  - Why Boothfile (comparison with Dockerfile)
  - Command reference table
  - Heredoc modes documentation
  - Variable usage with arg
  - Custom setup scripts
  - File precedence rules
  - Complete example
Add integration tests for:
- test014: --emit-dockerfile flag with auto-detected Boothfile
- test015: --boothfile flag to explicitly specify Boothfile path

Tests verify that the Boothfile compiler correctly generates:
- Dockerfile prologue (syntax, ARG, FROM, SHELL, etc.)
- Compiled commands (setup, install, env)
Demonstrates Boothfile DSL features:
- Setup commands (python, nodejs)
- Install commands (pip, npm packages)
- Build arguments with defaults
- Environment variables
- Heredoc support with and-join mode
- Expose ports

Includes Flask app, README, booth wrapper, and test script.
@NawaMan NawaMan changed the title Feature/boothfile Boothfile Feb 5, 2026
@NawaMan NawaMan merged commit e54f8fd into main Feb 5, 2026
7 checks passed
@NawaMan NawaMan deleted the feature/Boothfile branch February 5, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant