Created
June 30, 2022 04:35
-
-
Save MateusBMP/ec0285565e5f6902ed46e03f231c9167 to your computer and use it in GitHub Desktop.
Build Docker images with PECL packages without using the PECL command
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| # see: https://olvlvl.com/2019-06-docker-pecl-without-pecl | |
| set -e | |
| dir=/usr/src/php | |
| if [ ! -f "$dir/.docker-extracted" ]; then | |
| echo >&2 "error: PHP source required, run 'docker-php-source extract' first" | |
| exit 1 | |
| fi | |
| dir="$dir/ext" | |
| usage() { | |
| echo "usage: $0 module-name module-version" | |
| echo " ie: $0 redis 4.3.0" | |
| } | |
| name=$1 | |
| version=$2 | |
| if [ -z "$name" ]; then | |
| usage >&2 | |
| exit 1 | |
| fi | |
| if [ -z "$version" ]; then | |
| usage >&2 | |
| exit 1 | |
| fi | |
| mkdir -p "$dir/$name" | |
| curl -fsSL "https://pecl.php.net/get/$name-$version.tgz" | tar xvz -C "$dir/$name" --strip 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment