diff --git a/.github/workflows/test-formulas.yml b/.github/workflows/test-formulas.yml new file mode 100644 index 0000000..1c28d3e --- /dev/null +++ b/.github/workflows/test-formulas.yml @@ -0,0 +1,53 @@ +name: Test Homebrew Formulas + +on: + push: + branches: + - feature/update + +jobs: + test: + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + #- name: Check and install Homebrew + # run: | + # if ! command -v brew &>/dev/null; then + # /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + # echo "/home/linuxbrew/.linuxbrew/bin/" >> $PATH + # fi + + - name: Install Homebrew + run: echo $PATH && brew update + + - name: Install dependencies + run: | + brew install coreutils docker colima + brew services start colima + + - name: List Formula directory contents + run: ls -l ./Formula + + - name: Get formula names + id: get_formulas + run: | + formula_string="" + while IFS= read -r -d $'\0' formula_file; do + formula_name=$(basename "$formula_file" .rb) + echo "Found formula: $formula_name" + formula_string="$formula_string $formula_name" + done < <(find ./Formula -maxdepth 1 -type f -name '*.rb' -print0) + echo "FORMULAS=$formula_string" >> $GITHUB_ENV + echo "Final formulas: $formula_string" + + - name: Test each formula + run: | + echo "Formulas to test: ${FORMULAS}" + for formula in ${FORMULAS}; do + echo "Testing formula: $formula" + brew install dockbrew/tap/$formula || echo "Error installing $formula" + brew audit --strict --new --online dockbrew/tap/$formula + brew test dockbrew/tap/$formula + done diff --git a/ab.rb b/Formula/ab.rb similarity index 53% rename from ab.rb rename to Formula/ab.rb index e9cf791..08dc36b 100644 --- a/ab.rb +++ b/Formula/ab.rb @@ -1,11 +1,16 @@ class Ab < Formula - desc "install ApacheBench as a docker container" + desc "Install ApacheBench as a docker container" homepage "https://github.com/jfrazelle/dockerfiles/tree/master/ab" - url "https://github.com/dockbrew/ab/archive/2.3.tar.gz" - version "2.3" + url "https://github.com/dockbrew/ab/archive/refs/tags/2.3.tar.gz" sha256 "8818e940beb458743bdf3a1fc3c3b373956fc89379eb5025ad0f6b8c2465aad6" + depends_on "docker" + def install bin.install "ab" end + + test do + system bin/"ab", "-V" + end end diff --git a/README.md b/README.md index d6a455a..31cbe0e 100644 --- a/README.md +++ b/README.md @@ -1,86 +1,118 @@ # homebrew-docker -containerized equivalent of your usual tools/app with [homebrew](http://brew.sh) workflow :) + +Containerized equivalent of your usual tools/app with [homebrew](http://brew.sh) workflow :) + +## Table of Contents + +* [Usage](#usage) + * [Get dockbrew](#get-dockbrew) + * [Search all dockbrew formulas](#search-all-dockbrew-formulas) + * [Install dockbrew powered app/tools/package](#install-dockbrew-powered-apptoolspackage) +* [Known caveats & issues](#known-caveats--issues) +* [Troubleshooting](#troubleshooting) +* [Contributing](#contributing) +* [License](#license) + ## Usage ### Get dockbrew - $ brew tap dockbrew/tap - ==> Tapping dockbrew/tap - Cloning into '/usr/local/Library/Taps/dockbrew/homebrew-tap'... + +```bash +brew tap dockbrew/tap +``` ### Search all dockbrew formulas - brew search dockbrew - dockbrew/tap/ab dockbrew/tap/docker-composer - dockbrew/tap/docker-ansible dockbrew/tap/docker-hugo + +```bash +brew search dockbrew +``` ### Install dockbrew powered app/tools/package Here is an example: Get ApacheBench (ab) - $ brew install dockbrew/tap/ab - ==> Installing ab from dockbrew/homebrew-tap - ==> Downloading https://github.com/dockbrew/ab/archive/2.3.tar.gz - Already downloaded: /Library/Caches/Homebrew/ab-2.3.tar.gz - 🍺 /usr/local/Cellar/ab/2.3: 2 files, 8.0K, built in 2 seconds +```bash +brew install dockbrew/tap/ab +``` And run it as you usually do - $ ab -n10 -c10 http://www.google.fr/ - This is ApacheBench, Version 2.3 <$Revision: 1663405 $> - Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ - Licensed to The Apache Software Foundation, http://www.apache.org/ - - Benchmarking www.google.fr (be patient).....done - - - Server Software: gws - Server Hostname: www.google.fr - Server Port: 80 - - Document Path: / - Document Length: 153980 bytes - - Concurrency Level: 10 - Time taken for tests: 2.003 seconds - Complete requests: 10 - Failed requests: 9 - (Connect: 0, Receive: 0, Length: 9, Exceptions: 0) - Total transferred: 1547790 bytes - HTML transferred: 1539572 bytes - Requests per second: 4.99 [#/sec] (mean) - Time per request: 2003.045 [ms] (mean) - Time per request: 200.305 [ms] (mean, across all concurrent requests) - Transfer rate: 754.61 [Kbytes/sec] received - - Connection Times (ms) - min mean[+/-sd] median max - Connect: 27 30 2.6 31 34 - Processing: 922 1454 362.1 1608 1975 - Waiting: 70 206 233.0 163 861 - Total: 950 1484 363.1 1639 2003 - - Percentage of the requests served within a certain time (ms) - 50% 1639 - 66% 1696 - 75% 1790 - 80% 1889 - 90% 2003 - 95% 2003 - 98% 2003 - 99% 2003 - 100% 2003 (longest request) - -## Known caveats && issues -Dockbrew is in pre-alpha release state, it leverage docker to unclutter your MacOSX host. You first need to run a docker-host locally on your Mac host (`docker-machine` comes in handy, jusr run `docker-machine create dockbrew -d virtualbox && eval "$(docker-machine env dockbrew)"`) +```bash +ab -n10 -c10 http://www.google.fr/ +``` + +This will output benchmarking results similar to the example below: + +``` +This is ApacheBench, Version 2.3 <$Revision: 1663405 $> +Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ +Licensed to The Apache Software Foundation, http://www.apache.org/ + +Benchmarking www.google.fr (be patient).....done + + +Server Software: gws +Server Hostname: www.google.fr +Server Port: 80 + +Document Path: / +Document Length: 153980 bytes + +Concurrency Level: 10 +Time taken for tests: 2.003 seconds +Complete requests: 10 +Failed requests: 9 + (Connect: 0, Receive: 0, Length: 9, Exceptions: 0) +Total transferred: 1547790 bytes +HTML transferred: 1539572 bytes +Requests per second: 4.99 [#/sec] (mean) +Time per request: 2003.045 [ms] (mean) +Time per request: 200.305 [ms] (mean, across all concurrent requests) +Transfer rate: 754.61 [Kbytes/sec] received + +Connection Times (ms) + min mean[+/-sd] median max +Connect: 27 30 2.6 31 34 +Processing: 922 1454 362.1 1608 1975 +Waiting: 70 206 233.0 163 861 +Total: 950 1484 363.1 1639 2003 + +Percentage of the requests served within a certain time (ms) + 50% 1639 + 66% 1696 + 75% 1790 + 80% 1889 + 90% 2003 + 95% 2003 + 98% 2003 + 99% 2003 + 100% 2003 (longest request) +``` + +## Known caveats & issues + +Dockbrew is in pre-alpha release state; it leverages Docker to unclutter your MacOSX host. You first need to run a Docker host locally on your Mac host (`docker-machine` comes in handy; just run `docker-machine create dockbrew -d virtualbox && eval "$(docker-machine env dockbrew)"`). + +## Troubleshooting + +* **Error: `docker-machine` not found:** Ensure Docker Machine is installed and configured correctly. Refer to the Docker documentation for installation and setup instructions. +* **Error: Permission denied:** Check your Docker permissions and ensure the user has the necessary privileges to run Docker commands. +* **Error during installation:** Check your internet connection and try again. If the problem persists, check the [issues](https://github.com/dockbrew/homebrew-tap/issues) page for similar problems or open a new issue. + ## Contributing -First, thank you for contributing! We love pull requests from everyone. -Here are a few technical guidelines to follow: -1. Open an [issue](https://github.com/dockbrew/homebrew-tap/issues) to discuss a new feature. -1. Open a Pull Request. -1. Edit/Squash after receiving feedback. -1. Party! +First, thank you for contributing! We love pull requests from everyone. Please follow these steps: + +1. Fork the repository. +2. Create a new branch for your feature or bug fix. +3. Make your changes and commit them with clear and concise messages. +4. Push your branch to your forked repository. +5. Open a pull request, clearly describing your changes and their purpose. +6. Address any feedback provided by the maintainers. + ## License + [GNU GENERAL PUBLIC LICENSE v2](http://www.gnu.org/licenses/gpl-2.0.fr.html) diff --git a/docker-ansible.rb b/docker-ansible.rb deleted file mode 100644 index cf9dc4f..0000000 --- a/docker-ansible.rb +++ /dev/null @@ -1,17 +0,0 @@ -class DockerAnsible < Formula - desc "install ansible as a docker container" - homepage "" - url "https://github.com/dockbrew/docker-ansible/archive/1.9.2.tar.gz" - version "1.9.2" - sha256 "395fba36e42c2f08f21ddfabdf48c2b6de08a8e514bbf611e51548fa38bc5016" - - def install - bin.install "docker-ansible" - bin.install "docker-ansible-galaxy" - bin.install "docker-ansible-playbook" - bin.install "docker-ansible-pull" - bin.install "docker-ansible-push" - bin.install "docker-ansible-vault" - bin.install "docker-ansible-doc" - end -end diff --git a/docker-composer.rb b/docker-composer.rb deleted file mode 100644 index 75c43a9..0000000 --- a/docker-composer.rb +++ /dev/null @@ -1,11 +0,0 @@ -class DockerComposer < Formula - desc "install composer as a docker container" - homepage "" - url "https://github.com/dockbrew/docker-composer/archive/0.1.1.tar.gz" - version "0.1.1" - sha256 "105797a9977ad0e426bb52c1bf045f63f55d3c924e6bff2214e0b856b973fa6a" - - def install - bin.install "docker-composer" - end -end diff --git a/docker-hugo.rb b/docker-hugo.rb deleted file mode 100644 index e5af07a..0000000 --- a/docker-hugo.rb +++ /dev/null @@ -1,11 +0,0 @@ -class DockerHugo < Formula - desc "install hugo as a docker container" - homepage "" - url "https://github.com/dockbrew/docker-hugo/archive/0.13.tar.gz" - version "0.13" - sha256 "1d6aa5e07fed2a58dbe7e066f82b74c554af489d7ea0196682a1871b78cf56c2" - - def install - bin.install "docker-hugo" - end -end