diff --git a/.containerignore b/.containerignore deleted file mode 100644 index d5256af..0000000 --- a/.containerignore +++ /dev/null @@ -1,19 +0,0 @@ -# Ignore files for Apple container command builds -node_modules -npm-debug.log -build -.git -.gitignore -README.md -DEVELOPMENT.md -.env -.nyc_output -coverage -.coverage -**/*.test.js -**/*.spec.js -scripts/ -demo.sh -.dockerignore -docker-compose.yml -Dockerfile.dev \ No newline at end of file diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 8f269b8..80d66df 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -24,9 +24,3 @@ Framework to be used: ## Containerization The application should be prepared for deployment using containerization. It should extend minimal Node 24 LTS container image. - -Do not assume the Docker is installed on the development machine. - -The development machine is a MacOS system with Apple `container` command from @github/apple/container. - -Build scripts should target MacOS with the above toolset as first class environment. Docker should be used only as secondary option. diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 97731b0..ccfb775 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -8,7 +8,6 @@ on: - 'public/**' - 'package*.json' - 'Dockerfile' - - 'Containerfile' pull_request: branches: [ main ] paths: @@ -16,7 +15,6 @@ on: - 'public/**' - 'package*.json' - 'Dockerfile' - - 'Containerfile' env: IMAGE_NAME: jmespath-playground diff --git a/Containerfile b/Containerfile deleted file mode 100644 index a2ad2b3..0000000 --- a/Containerfile +++ /dev/null @@ -1,24 +0,0 @@ -# Containerfile for Apple container command -# Use Node 24 LTS as base image -FROM node:24-alpine - -# Set working directory -WORKDIR /app - -# Copy package files -COPY package*.json ./ - -# Install dependencies -RUN npm ci --only=production - -# Copy application source -COPY . . - -# Build the application -RUN npm run build - -# Expose port 3000 -EXPOSE 3000 - -# Start the application -CMD ["npm", "run", "serve"] \ No newline at end of file diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 5c6809f..f636b64 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -2,26 +2,10 @@ ## Quick Start Commands -### macOS Development (Recommended) - ```bash # Install dependencies npm install -# Start macOS-optimized development server -npm run dev - -# Build with macOS toolset (Apple container + Docker fallback) -npm run build:macos - -# Container operations (macOS) -npm run container:build -npm run container:run -``` - -### Traditional Commands - -```bash # Start development server (with hot reload) npm start @@ -35,22 +19,7 @@ npm test npm run serve ``` -## Container Commands - -### Apple Container (Primary - macOS) - -```bash -# Build container with Apple's container command -container build -t jmespath-playground . - -# Run container -container run -p 3000:3000 jmespath-playground - -# Using Containerfile (Apple's format) -container build -f Containerfile -t jmespath-playground . -``` - -### Docker (Fallback) +## Docker Commands ```bash # Build Docker container @@ -140,4 +109,4 @@ npm run docker:build npm run docker:run ``` -The workflow uses Docker in the GitHub Actions environment while maintaining compatibility with the project's macOS-first development approach. \ No newline at end of file +The workflow uses Docker for consistent containerization across all environments. \ No newline at end of file diff --git a/README.md b/README.md index 8b43a4e..48cdd73 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ A React-based web application for testing and validating JMESPath expressions ag - ๐ŸŽจ **Bootstrap UI**: Clean, responsive interface with Bootstrap styling - ๐Ÿ”„ **Sample Data**: Pre-loaded examples to get started quickly - ๐Ÿ“ฑ **Responsive Design**: Works on desktop, tablet, and mobile devices -- ๐Ÿณ **Container Ready**: Containerized for easy deployment (macOS + Docker) +- ๐Ÿณ **Docker Ready**: Containerized for easy deployment - โœ… **Error Handling**: Clear error messages for both JSON and JMESPath syntax issues - ๐Ÿš€ **CI/CD Ready**: GitHub Actions workflow for automated container builds @@ -33,7 +33,6 @@ The application is divided into three main sections: - Node.js 24 LTS or higher - npm or yarn package manager -- **macOS recommended** (optimized for Apple's container toolset) ### Local Development @@ -48,10 +47,8 @@ The application is divided into three main sections: npm install ``` -3. **Start the development server** (macOS optimized): +3. **Start the development server**: ```bash - npm run dev - # or traditional: npm start ``` @@ -59,22 +56,7 @@ The application is divided into three main sections: ### Container Deployment -#### macOS with Apple Container (Recommended) - -```bash -# Build using macOS-optimized script -npm run build:macos - -# Or manually with Apple container command -container build -t jmespath-playground . -container run -p 3000:3000 jmespath-playground - -# Using npm scripts -npm run container:build -npm run container:run -``` - -#### Docker (Fallback Option) +#### Docker ```bash # Build the Docker image @@ -112,26 +94,14 @@ Try these examples with the sample data: In the project directory, you can run: -### Development Scripts - -### `npm run dev` - -Starts the development server with macOS optimizations. Checks environment and opens the app at http://localhost:3000. - ### `npm start` -Runs the app in development mode using React's default development server. The page will reload when you make edits. +Runs the app in development mode. The page will reload when you make edits. ### `npm test` Launches the test runner in interactive watch mode. -### Build Scripts - -### `npm run build:macos` - -Builds the application and creates containers using macOS-optimized build script. Prioritizes Apple's container command with Docker fallback. - ### `npm run build` Builds the app for production to the `build` folder. It correctly bundles React in production mode and optimizes the build for the best performance. @@ -140,19 +110,11 @@ Builds the app for production to the `build` folder. It correctly bundles React Serves the production build locally on port 3000. -### Container Scripts - -### `npm run container:build` - -Builds a container using Apple's container command (macOS). - -### `npm run container:run` - -Runs the container using Apple's container command. +### Docker Scripts ### `npm run docker:build` -Builds a Docker container (fallback option). +Builds a Docker container. ### `npm run docker:run` @@ -179,10 +141,9 @@ jmespath-playground/ โ”‚ โ”œโ”€โ”€ setupTests.js # Test configuration โ”‚ โ””โ”€โ”€ reportWebVitals.js โ”œโ”€โ”€ scripts/ -โ”‚ โ”œโ”€โ”€ build.sh # macOS-optimized build script -โ”‚ โ””โ”€โ”€ dev.sh # macOS-optimized development script -โ”œโ”€โ”€ Containerfile # Apple container build file -โ”œโ”€โ”€ Dockerfile # Docker container (fallback) +โ”‚ โ”œโ”€โ”€ build.sh # Build script +โ”‚ โ””โ”€โ”€ dev.sh # Development script +โ”œโ”€โ”€ Dockerfile # Docker container โ”œโ”€โ”€ Dockerfile.dev # Development container โ”œโ”€โ”€ docker-compose.yml # Container orchestration โ”œโ”€โ”€ package.json # Dependencies and scripts @@ -197,8 +158,7 @@ jmespath-playground/ - **Bootstrap 5.3.2**: CSS framework for styling - **JMESPath 0.16.0**: JMESPath expression evaluation - **Node.js 24 LTS**: Runtime environment -- **Apple Container**: Primary containerization (macOS) -- **Docker**: Containerization fallback +- **Docker**: Containerization - **GitHub Actions**: Automated CI/CD pipeline ## CI/CD Pipeline @@ -208,32 +168,18 @@ The project includes a GitHub Actions workflow that automatically: - ๐Ÿ” **Triggers** on pushes to `main` or `develop` branches when `src/` directory changes - ๐Ÿ“ฆ **Builds** the React application with Node.js 24 LTS - ๐Ÿงช **Runs** the test suite with coverage reporting -- ๐Ÿณ **Creates** container image using Docker (GitHub Actions environment) +- ๐Ÿณ **Creates** container image using Docker - โœ… **Tests** the container by starting it and verifying HTTP response - ๐Ÿ—๏ธ **Builds** multi-platform images (amd64/arm64) for main branch - ๐Ÿ“ค **Uploads** build artifacts for later use -The workflow is optimized for the GitHub Actions environment while respecting the project's macOS-first philosophy for local development. +The workflow uses Docker for containerization and is optimized for cross-platform deployment. ## Deployment -### Container Deployment (macOS Recommended) +### Docker Deployment -The application is designed for macOS-first containerization: - -1. **Build using macOS toolset**: - ```bash - npm run build:macos - ``` - -2. **Deploy using Apple container command**: - ```bash - container run -p 3000:3000 jmespath-playground - ``` - -### Docker Deployment (Fallback) - -For environments without Apple's container toolset: +The application is containerized and ready for deployment: 1. **Build the Docker image**: ```bash diff --git a/demo.sh b/demo.sh index bc007b4..688db08 100755 --- a/demo.sh +++ b/demo.sh @@ -1,19 +1,11 @@ #!/bin/bash # JMESPath Testing Tool - Demo Script -# Optimized for macOS with Apple container command -echo "๐ŸŽ JMESPath Testing Tool Demo" +echo "๐Ÿš€ JMESPath Testing Tool Demo" echo "===============================" echo "" -# Check if running on macOS -if [[ "$OSTYPE" == "darwin"* ]]; then - echo "โœ… Running on macOS (recommended platform)" -else - echo "โš ๏ธ Not running on macOS. This demo is optimized for macOS." -fi - # Check if Node.js is installed if command -v node &> /dev/null; then echo "โœ… Node.js version: $(node --version)" @@ -30,16 +22,11 @@ else exit 1 fi -# Check container runtimes -if command -v container &> /dev/null; then - echo "โœ… Apple container command available" +# Check Docker +if command -v docker &> /dev/null; then + echo "โœ… Docker available" else - echo "โš ๏ธ Apple container command not found" - if command -v docker &> /dev/null; then - echo "โœ… Docker available as fallback" - else - echo "โš ๏ธ No container runtime found" - fi + echo "โš ๏ธ Docker not found" fi echo "" @@ -47,25 +34,22 @@ echo "๐Ÿ“ฆ Installing dependencies..." npm install echo "" -echo "๐Ÿ”จ Building with macOS-optimized script..." -npm run build:macos +echo "๐Ÿ”จ Building production version..." +npm run build echo "" echo "๐ŸŽ‰ Demo completed successfully!" echo "" -echo "To start development (macOS optimized):" -echo " npm run dev" -echo "" -echo "To start development (traditional):" +echo "To start development:" echo " npm start" echo "" echo "To serve the production build:" echo " npm run serve" echo "" -echo "To run with containers:" -if command -v container &> /dev/null; then - echo " npm run container:run # Apple container (recommended)" -fi +echo "To run with Docker:" if command -v docker &> /dev/null; then - echo " npm run docker:run # Docker (fallback)" + echo " npm run docker:build" + echo " npm run docker:run" +else + echo " (Docker not available - install Docker first)" fi \ No newline at end of file diff --git a/package.json b/package.json index 51c1a70..553dd63 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,6 @@ "test": "react-scripts test", "eject": "react-scripts eject", "serve": "serve -s build -l 3000", - "dev": "./scripts/dev.sh", - "build:macos": "./scripts/build.sh", - "container:build": "container build -t jmespath-playground .", - "container:run": "container run -p 3000:3000 jmespath-playground", "docker:build": "docker build -t jmespath-playground .", "docker:run": "docker run -p 3000:3000 jmespath-playground" }, @@ -54,8 +50,7 @@ "json", "query", "testing", - "react", - "macos" + "react" ], "author": "", "license": "MIT" diff --git a/scripts/build.sh b/scripts/build.sh index 34ede06..51c01bd 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,12 +1,11 @@ #!/bin/bash # JMESPath Testing Tool - Build Script -# Targets macOS with Apple container command as first-class environment set -e -echo "๐ŸŽ JMESPath Testing Tool - macOS Build Script" -echo "=============================================" +echo "๐Ÿš€ JMESPath Testing Tool - Build Script" +echo "=======================================" echo "" # Check Node.js version @@ -31,27 +30,19 @@ npm install echo "๐Ÿ”จ Building production bundle..." npm run build -# Container build - prioritize Apple container command -if command -v container &> /dev/null; then - echo "๐ŸŽ Building container with Apple container command..." - container build -t jmespath-playground . +# Container build with Docker +if command -v docker &> /dev/null; then + echo "๐Ÿณ Building Docker container..." + docker build -t jmespath-playground . else - # Fallback to Docker if available - if command -v docker &> /dev/null; then - echo "๐Ÿณ Apple container command not found, falling back to Docker..." - docker build -t jmespath-playground . - else - echo "โš ๏ธ No container runtime found. Skipping container build." - echo " Install Apple container command or Docker to build containers." - fi + echo "โš ๏ธ Docker not found. Skipping container build." + echo " Install Docker to build containers." fi echo "โœ… Build completed successfully!" echo "" echo "To run the application:" echo " npm run serve # Serve production build locally" -if command -v container &> /dev/null; then - echo " container run -p 3000:3000 jmespath-playground # Run with Apple container" -elif command -v docker &> /dev/null; then - echo " docker run -p 3000:3000 jmespath-playground # Run with Docker" +if command -v docker &> /dev/null; then + echo " docker run -p 3000:3000 jmespath-playground # Run with Docker" fi \ No newline at end of file diff --git a/scripts/dev.sh b/scripts/dev.sh index e6f490d..579ad6c 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -1,21 +1,13 @@ #!/bin/bash # JMESPath Testing Tool - Development Script -# Optimized for macOS development environment set -e -echo "๐ŸŽ JMESPath Testing Tool - macOS Development" -echo "===========================================" +echo "๐Ÿš€ JMESPath Testing Tool - Development" +echo "=====================================" echo "" -# Check environment -if [[ "$OSTYPE" == "darwin"* ]]; then - echo "โœ… Running on macOS" -else - echo "โš ๏ธ This script is optimized for macOS but will attempt to run anyway." -fi - # Check Node.js if command -v node &> /dev/null; then echo "โœ… Node.js version: $(node --version)"