diff --git a/README.md b/README.md index d5b083a..0f635e1 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ Skip this step if your base image is ubuntu or opensuse-leap. If you are buildin | Parameter | Description | Type | Default Value | |------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|-------------------------| | CUSTOM_TAG | Environment name for provider image tagging. The default value is `demo`. | String | `demo` | +| EARTHLY_BIN | Path to earthly binary on the host system (e.g. /usr/local/bin/earthly). If empty the docker image of earthly is used. | String | | | IMAGE_REGISTRY | Image registry name that will store the image artifacts. The default value points to the *ttl.sh* image registry, an anonymous and ephemeral Docker image registry where images live for a maximum of 24 hours by default. If you wish to make the images exist longer than 24 hours, you can use any other image registry to suit your needs. | String | `ttl.sh` | | OS_DISTRIBUTION | OS distribution of your choice. For example, it can be `ubuntu` or `opensuse-leap`. | String | `ubuntu` | | IMAGE_REPO | Image repository name in your chosen registry. | String | `$OS_DISTRIBUTION` | diff --git a/earthly.sh b/earthly.sh index 84650b7..e092247 100755 --- a/earthly.sh +++ b/earthly.sh @@ -1,4 +1,7 @@ #!/bin/bash + +set -e + function build_with_proxy() { export HTTP_PROXY=$HTTP_PROXY export HTTPS_PROXY=$HTTPS_PROXY @@ -37,7 +40,9 @@ if ! docker run --rm --privileged alpine sh -c 'echo "Privileged container test" echo "Privileged containers are not allowed for the current user." exit 1 fi -if [ -z "$HTTP_PROXY" ] && [ -z "$HTTPS_PROXY"]; then +if [ ! -z "${EARTHLY_BIN}" ]; then + "${EARTHLY_BIN}" --allow-privileged "$@" +elif [ -z "$HTTP_PROXY" ] && [ -z "$HTTPS_PROXY"]; then build_without_proxy "$@" else build_with_proxy "$@"