From 992e37f9af86c6e60dbea79a5bd0ab076ed3e5a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:08:27 +0000 Subject: [PATCH 1/5] Initial plan From e71a3d7693ddd00378926a12e2233d545c2735b4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:11:33 +0000 Subject: [PATCH 2/5] docs: add Docker Compose examples and usage instructions Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com> --- README.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 35 +++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index e01b24c..04bcb8b 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,77 @@ docker run -e LOG_LEVEL=debug -v /path/to/comics:/comics ghcr.io/belphemur/cbzop The official Docker image is available at: `ghcr.io/belphemur/cbzoptimizer:latest` +### Docker Compose + +You can use Docker Compose to run CBZOptimizer with persistent configuration. Create a `docker-compose.yml` file: + +```yaml +version: '3.8' + +services: + cbzoptimizer: + image: ghcr.io/belphemur/cbzoptimizer:latest + container_name: cbzoptimizer + environment: + # Set log level (panic, fatal, error, warn, info, debug, trace) + - LOG_LEVEL=info + # User and Group ID for file permissions + - PUID=99 + - PGID=100 + volumes: + # Mount your comics directory + - /path/to/your/comics:/comics + # Optional: Mount a config directory for persistent settings + - ./config:/config + # Example: Optimize all comics in the /comics directory + command: optimize /comics --quality 85 --parallelism 2 --override --format webp --split + restart: unless-stopped +``` + +For watch mode, you can create a separate service: + +```yaml + cbzoptimizer-watch: + image: ghcr.io/belphemur/cbzoptimizer:latest + container_name: cbzoptimizer-watch + environment: + - LOG_LEVEL=info + - PUID=99 + - PGID=100 + volumes: + - /path/to/watch/directory:/watch + - ./config:/config + # Watch for new files and automatically optimize them + command: watch /watch --quality 85 --override --format webp --split + restart: unless-stopped +``` + +**Important Notes:** +- Replace `/path/to/your/comics` and `/path/to/watch/directory` with your actual directory paths +- The `PUID` and `PGID` environment variables control file permissions (default: 99/100) +- The `LOG_LEVEL` environment variable sets the logging verbosity +- For one-time optimization, remove the `restart: unless-stopped` line +- Watch mode only works on Linux systems + +#### Running with Docker Compose + +```sh +# Start the service (one-time optimization) +docker-compose up cbzoptimizer + +# Start in detached mode +docker-compose up -d cbzoptimizer + +# Start watch mode service +docker-compose up -d cbzoptimizer-watch + +# View logs +docker-compose logs -f cbzoptimizer + +# Stop services +docker-compose down +``` + ## Troubleshooting If you encounter issues: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9d11fcf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3.8' + +services: + cbzoptimizer: + image: ghcr.io/belphemur/cbzoptimizer:latest + container_name: cbzoptimizer + environment: + # Set log level (panic, fatal, error, warn, info, debug, trace) + - LOG_LEVEL=info + # User and Group ID for file permissions + - PUID=99 + - PGID=100 + volumes: + # Mount your comics directory + - /path/to/your/comics:/comics + # Optional: Mount a config directory for persistent settings + - ./config:/config + # Example: Optimize all comics in the /comics directory + command: optimize /comics --quality 85 --parallelism 2 --override --format webp --split + restart: unless-stopped + + # Example: Watch mode service + cbzoptimizer-watch: + image: ghcr.io/belphemur/cbzoptimizer:latest + container_name: cbzoptimizer-watch + environment: + - LOG_LEVEL=info + - PUID=99 + - PGID=100 + volumes: + - /path/to/watch/directory:/watch + - ./config:/config + # Watch for new files and automatically optimize them + command: watch /watch --quality 85 --override --format webp --split + restart: unless-stopped From 44a47262582256c07d1086d1486fa4fde0b7b947 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:14:57 +0000 Subject: [PATCH 3/5] ci: rename copilot-setup workflow to copilot-setup-steps and follow standard pattern Co-authored-by: Belphemur <197810+Belphemur@users.noreply.github.com> --- .github/workflows/copilot-setup-steps.yml | 79 ++++++++++++++++++++++ .github/workflows/copilot-setup.yml | 81 ----------------------- 2 files changed, 79 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/copilot-setup-steps.yml delete mode 100644 .github/workflows/copilot-setup.yml diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000..5be7ead --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,79 @@ +name: Copilot Setup Steps +permissions: + contents: read + +on: + workflow_dispatch: + +jobs: + copilot-setup-steps: + name: Setup Go and gopls + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + cache: true + + - name: Verify Go installation + run: | + go version + go env + + - name: Install gopls + run: | + go install golang.org/x/tools/gopls@latest + + - name: Verify gopls installation + run: | + gopls version + + - name: Install golangci-lint + uses: golangci/golangci-lint-action@v9 + with: + version: latest + + - name: Download Go dependencies + run: | + go mod download + go mod verify + + - name: Build encoder-setup utility + run: | + go build -tags encoder_setup -o encoder-setup ./cmd/encoder-setup + ls -lh encoder-setup + + - name: Run encoder-setup + run: | + ./encoder-setup + + - name: Build application + run: | + go build -o cbzconverter ./cmd/cbzoptimizer + + - name: Verify build + run: | + ls -lh cbzconverter + file cbzconverter + + - name: Install gotestsum + run: | + go install gotest.tools/gotestsum@latest + + - name: Verify gotestsum installation + run: | + gotestsum --version + + - name: Setup complete + run: | + echo "✅ Go environment setup complete" + echo "✅ gopls (Go language server) installed" + echo "✅ golangci-lint installed" + echo "✅ Dependencies downloaded and verified" + echo "✅ WebP encoder configured (libwebp 1.6.0)" + echo "✅ Application built successfully" + echo "✅ gotestsum (test runner) installed" diff --git a/.github/workflows/copilot-setup.yml b/.github/workflows/copilot-setup.yml deleted file mode 100644 index 33bf881..0000000 --- a/.github/workflows/copilot-setup.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: GitHub Copilot Setup -permissions: - contents: read - -on: - workflow_dispatch: # Allow manual triggering - -jobs: - copilot-setup: - name: Setup Development Environment for Copilot - runs-on: ubuntu-latest - permissions: - contents: read - - steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Set up Go - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - cache: true - - - name: Build encoder-setup utility - run: | - echo "Building encoder-setup utility with encoder_setup build tag..." - go build -tags encoder_setup -o encoder-setup ./cmd/encoder-setup - ls -lh encoder-setup - - - name: Run encoder-setup - run: | - echo "Running encoder-setup to configure WebP encoder..." - ./encoder-setup - echo "Encoder setup completed successfully" - - - name: Verify Go environment - run: | - echo "=== Go Environment ===" - go version - go env - echo "" - echo "=== Go Module Info ===" - go list -m all | head -20 - - - name: Install development tools - run: | - echo "Installing gotestsum for testing..." - go install gotest.tools/gotestsum@latest - - echo "Installing golangci-lint for linting..." - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin - - echo "Development tools installed successfully" - - - name: Verify installation - run: | - echo "=== Verifying tools ===" - which gotestsum && gotestsum --version - which golangci-lint && golangci-lint --version - - - name: Setup summary - if: always() - run: | - echo "## GitHub Copilot Development Environment Setup Complete! 🚀" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Environment Details" >> $GITHUB_STEP_SUMMARY - echo "- **Go Version:** $(go version | cut -d' ' -f3)" >> $GITHUB_STEP_SUMMARY - echo "- **Platform:** ubuntu-latest" >> $GITHUB_STEP_SUMMARY - echo "- **WebP Encoder:** Configured (libwebp 1.6.0)" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Installed Tools" >> $GITHUB_STEP_SUMMARY - echo "- ✅ encoder-setup (WebP configuration)" >> $GITHUB_STEP_SUMMARY - echo "- ✅ gotestsum (test runner)" >> $GITHUB_STEP_SUMMARY - echo "- ✅ golangci-lint (code quality)" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Next Steps" >> $GITHUB_STEP_SUMMARY - echo "1. Review the copilot instructions at \`.github/copilot-instructions.md\`" >> $GITHUB_STEP_SUMMARY - echo "2. Use \`go test ./...\` to run tests" >> $GITHUB_STEP_SUMMARY - echo "3. Use \`golangci-lint run\` for linting" >> $GITHUB_STEP_SUMMARY - echo "4. Build the application with \`go build -o cbzconverter ./cmd/cbzoptimizer\`" >> $GITHUB_STEP_SUMMARY From 43593c37fc0086a6ba8d9db5725cac479990742c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:16:16 +0000 Subject: [PATCH 4/5] ci: remove application build from copilot-setup-steps workflow Only build and run encoder-setup utility for WebP configuration. Application building is not required for Copilot development environment setup. --- .github/workflows/copilot-setup-steps.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml index 5be7ead..19599d2 100644 --- a/.github/workflows/copilot-setup-steps.yml +++ b/.github/workflows/copilot-setup-steps.yml @@ -51,15 +51,6 @@ jobs: run: | ./encoder-setup - - name: Build application - run: | - go build -o cbzconverter ./cmd/cbzoptimizer - - - name: Verify build - run: | - ls -lh cbzconverter - file cbzconverter - - name: Install gotestsum run: | go install gotest.tools/gotestsum@latest @@ -75,5 +66,4 @@ jobs: echo "✅ golangci-lint installed" echo "✅ Dependencies downloaded and verified" echo "✅ WebP encoder configured (libwebp 1.6.0)" - echo "✅ Application built successfully" echo "✅ gotestsum (test runner) installed" From ba1ab20697e9380e11f14d1986f3a5a2965b979f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Dec 2025 21:16:16 +0000 Subject: [PATCH 5/5] fix: improve format flag flexibility and usability The format flag now supports multiple input syntaxes for better user experience: - Space-separated: --format webp or -f webp - Equals syntax: --format=webp - Case-insensitive: webp, WEBP, and WebP are all valid This change centralizes format flag setup in setupFormatFlag() function, making it consistent across optimize and watch commands while supporting both command-line usage and viper configuration binding. The improvements enhance CLI usability without breaking existing usage patterns.