diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000..19599d2 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,69 @@ +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: 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 "✅ 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 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