mirror of
https://github.com/dokku/dokku.git
synced 2026-02-24 04:00:36 +01:00
Merge pull request #8101 from dokku/filter-build-args
Filter build docker-options correctly for each builder
This commit is contained in:
7
docs/appendices/0.37.0-migration-guide.md
Normal file
7
docs/appendices/0.37.0-migration-guide.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# 0.36.0 Migration Guide
|
||||
|
||||
## Removals
|
||||
|
||||
- Support for the `DOKKU_DOCKERFILE_CACHE_BUILD` environment variable has been removed. Use the `docker-options` plugin to set build arguments for your app instead.
|
||||
- Support for the `DOKKU_DOCKER_BUILD_OPTS` environment variable has been removed. Use the `docker-options` plugin to set build arguments for your app instead.
|
||||
- Support for the `no-cache` nixpacks property has been removed. Use the `docker-options` plugin to set build arguments for your app instead.
|
||||
@@ -110,7 +110,6 @@ The following config variables have special meanings and can be set in a variety
|
||||
| `DOKKU_DEFAULT_CHECKS_WAIT` | `10` | `dokku config:set` | If no user-defined checks are specified - or if the process being checked is not a `web` process - this is the period of time Dokku will wait before checking that a container is still running. |
|
||||
| `DOKKU_DISABLE_PROXY` | none | `dokku proxy:disable` <br /> `dokku proxy:enable` | Disables the proxy in front of your application, resulting in publicly routing the docker container. |
|
||||
| `DOKKU_DISABLE_APP_AUTOCREATION` | none | `dokku config:set` | Disables automatic creation of a non-existent app on deploy. |
|
||||
| `DOKKU_DOCKERFILE_CACHE_BUILD` | none | `dokku config:set` | |
|
||||
| `DOKKU_DOCKERFILE_START_CMD` | none | `dokku config:set` | |
|
||||
| `DOKKU_PARALLEL_ARGUMENTS`. | none | `dokku config:set` | Allows passing custom arguments to parallel for `ps:*all` commands |
|
||||
| `DOKKU_PROXY_PORT` | automatically assigned | `/etc/environment` <br /> `~dokku/.dokkurc` <br /> `~dokku/.dokkurc/*` <br /> `dokku config:set` | |
|
||||
|
||||
@@ -199,8 +199,6 @@ dokku config:set node-js-app DOKKU_DOCKERFILE_START_CMD="--harmony server.js"
|
||||
|
||||
To tell Docker what to run.
|
||||
|
||||
Setting `$DOKKU_DOCKERFILE_CACHE_BUILD` to `true` or `false` will enable or disable Docker's image layer cache. Lastly, for more granular build control, you may also pass any `docker build` option to `docker`, by setting `$DOKKU_DOCKER_BUILD_OPTS`.
|
||||
|
||||
### Procfiles and multiple processes
|
||||
|
||||
> [!IMPORTANT]
|
||||
|
||||
@@ -80,28 +80,10 @@ dokku builder-nixpacks:set --global nixpackstoml-path
|
||||
|
||||
### Disabling cache
|
||||
|
||||
Cache is enabled by default, but can be disabled by setting the `no-cache` property to `true`:
|
||||
Disable cache using the [docker-options] plugin:
|
||||
|
||||
```shell
|
||||
dokku builder-nixpacks:set node-js-app no-cache true
|
||||
```
|
||||
|
||||
The default value may be set by passing an empty value for the option:
|
||||
|
||||
```shell
|
||||
dokku builder-nixpacks:set node-js-app no-cache
|
||||
```
|
||||
|
||||
The `no-cache` property can also be set globally. The global default is `false`, and the global value is used when no app-specific value is set.
|
||||
|
||||
```shell
|
||||
dokku builder-nixpacks:set --global no-cache true
|
||||
```
|
||||
|
||||
The default value may be set by passing an empty value for the option.
|
||||
|
||||
```shell
|
||||
dokku builder-nixpacks:set --global no-cache
|
||||
dokku docker-options:add node-js-app build "--no-cache"
|
||||
```
|
||||
|
||||
### Displaying builder-nixpacks reports for an app
|
||||
@@ -117,23 +99,14 @@ dokku builder-nixpacks:report
|
||||
Builder-nixpacks computed nixpackstoml path: nixpacks2.toml
|
||||
Builder-nixpacks global nixpackstoml path: nixpacks.toml
|
||||
Builder-nixpacks nixpackstoml path: nixpacks2.toml
|
||||
Builder-nixpacks computed no cache: true
|
||||
Builder-nixpacks global no cache: false
|
||||
Builder-nixpacks no cache: true
|
||||
=====> python-sample builder-nixpacks information
|
||||
Builder-nixpacks computed nixpackstoml path: nixpacks.toml
|
||||
Builder-nixpacks global nixpackstoml path: nixpacks.toml
|
||||
Builder-nixpacks nixpackstoml path:
|
||||
Builder-nixpacks computed no cache: false
|
||||
Builder-nixpacks global no cache: false
|
||||
Builder-nixpacks no cache:
|
||||
=====> ruby-sample builder-nixpacks information
|
||||
Builder-nixpacks computed nixpackstoml path: nixpacks.toml
|
||||
Builder-nixpacks global nixpackstoml path: nixpacks.toml
|
||||
Builder-nixpacks nixpackstoml path:
|
||||
Builder-nixpacks computed no cache: false
|
||||
Builder-nixpacks global no cache: false
|
||||
Builder-nixpacks no cache:
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
@@ -147,17 +120,14 @@ dokku builder-nixpacks:report node-js-app
|
||||
Builder-nixpacks computed nixpackstoml path: nixpacks2.toml
|
||||
Builder-nixpacks global nixpackstoml path: nixpacks.toml
|
||||
Builder-nixpacks nixpackstoml path: nixpacks2.toml
|
||||
Builder-nixpacks computed no cache: true
|
||||
Builder-nixpacks global no cache: false
|
||||
Builder-nixpacks no cache: true
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku builder-nixpacks:report node-js-app --builder-nixpacks-no-cache
|
||||
dokku builder-nixpacks:report node-js-app --builder-nixpacks-nixpackstoml-path
|
||||
```
|
||||
|
||||
```
|
||||
true
|
||||
nixpacks2.toml
|
||||
```
|
||||
|
||||
@@ -89,28 +89,10 @@ dokku builder-railpack:set --global railpackjson-path
|
||||
|
||||
### Disabling cache
|
||||
|
||||
Cache is enabled by default, but can be disabled by setting the `no-cache` property to `true`:
|
||||
Disable cache using the [docker-options] plugin:
|
||||
|
||||
```shell
|
||||
dokku builder-railpack:set node-js-app no-cache true
|
||||
```
|
||||
|
||||
The default value may be set by passing an empty value for the option:
|
||||
|
||||
```shell
|
||||
dokku builder-railpack:set node-js-app no-cache
|
||||
```
|
||||
|
||||
The `no-cache` property can also be set globally. The global default is `false`, and the global value is used when no app-specific value is set.
|
||||
|
||||
```shell
|
||||
dokku builder-railpack:set --global no-cache true
|
||||
```
|
||||
|
||||
The default value may be set by passing an empty value for the option.
|
||||
|
||||
```shell
|
||||
dokku builder-railpack:set --global no-cache
|
||||
dokku docker-options:add node-js-app build "--no-cache"
|
||||
```
|
||||
|
||||
### Displaying builder-railpack reports for an app
|
||||
@@ -126,23 +108,14 @@ dokku builder-railpack:report
|
||||
Builder-railpack computed railpackjson path: railpack2.json
|
||||
Builder-railpack global railpackjson path: railpack.json
|
||||
Builder-railpack railpackjson path: railpack2.json
|
||||
Builder-railpack computed no cache: true
|
||||
Builder-railpack global no cache: false
|
||||
Builder-railpack no cache: true
|
||||
=====> python-sample builder-railpack information
|
||||
Builder-railpack computed railpackjson path: railpack.json
|
||||
Builder-railpack global railpackjson path: railpack.json
|
||||
Builder-railpack railpackjson path:
|
||||
Builder-railpack computed no cache: false
|
||||
Builder-railpack global no cache: false
|
||||
Builder-railpack no cache:
|
||||
=====> ruby-sample builder-railpack information
|
||||
Builder-railpack computed railpackjson path: railpack.json
|
||||
Builder-railpack global railpackjson path: railpack.json
|
||||
Builder-railpack railpackjson path:
|
||||
Builder-railpack computed no cache: false
|
||||
Builder-railpack global no cache: false
|
||||
Builder-railpack no cache:
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
@@ -156,17 +129,14 @@ dokku builder-railpack:report node-js-app
|
||||
Builder-railpack computed railpackjson path: railpack2.json
|
||||
Builder-railpack global railpackjson path: railpack.json
|
||||
Builder-railpack railpackjson path: railpack2.json
|
||||
Builder-railpack computed no cache: true
|
||||
Builder-railpack global no cache: false
|
||||
Builder-railpack no cache: true
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
```shell
|
||||
dokku builder-railpack:report node-js-app --builder-railpack-no-cache
|
||||
dokku builder-railpack:report node-js-app --builder-railpack-railpackjson-path
|
||||
```
|
||||
|
||||
```
|
||||
true
|
||||
railpack2.json
|
||||
```
|
||||
|
||||
@@ -18,6 +18,8 @@ Docker releases updates periodically to their engine. We recommend reading their
|
||||
|
||||
Before upgrading, check the migration guides to get comfortable with new features and prepare your deployment to be upgraded.
|
||||
|
||||
- [Upgrading to 0.37](/docs/appendices/0.37.0-migration-guide.md)
|
||||
- [Upgrading to 0.36](/docs/appendices/0.36.0-migration-guide.md)
|
||||
- [Upgrading to 0.35](/docs/appendices/0.35.0-migration-guide.md)
|
||||
- [Upgrading to 0.34](/docs/appendices/0.34.0-migration-guide.md)
|
||||
- [Upgrading to 0.33](/docs/appendices/0.33.0-migration-guide.md)
|
||||
|
||||
@@ -17,8 +17,6 @@ trigger-builder-dockerfile-builder-build() {
|
||||
dokku_log_info1 "Building $APP from Dockerfile"
|
||||
|
||||
local IMAGE=$(get_app_image_name "$APP")
|
||||
local DOKKU_DOCKERFILE_CACHE_BUILD=$(config_get "$APP" "DOKKU_DOCKERFILE_CACHE_BUILD")
|
||||
local DOKKU_DOCKER_BUILD_OPTS=$(config_get "$APP" "DOKKU_DOCKER_BUILD_OPTS")
|
||||
local DOCKER_BUILD_LABEL_ARGS=("--label=dokku" "--label=org.label-schema.schema-version=1.0" "--label=org.label-schema.vendor=dokku" "--label=com.dokku.image-stage=build" "--label=com.dokku.builder-type=dockerfile" "--label=com.dokku.app-name=$APP")
|
||||
|
||||
pushd "$SOURCECODE_WORK_DIR" &>/dev/null
|
||||
@@ -34,17 +32,221 @@ trigger-builder-dockerfile-builder-build() {
|
||||
fi
|
||||
plugn trigger pre-build "$BUILDER_TYPE" "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
[[ "$DOKKU_DOCKERFILE_CACHE_BUILD" == "false" ]] && DOKKU_DOCKER_BUILD_OPTS="$DOKKU_DOCKER_BUILD_OPTS --no-cache"
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=" $DOKKU_GLOBAL_BUILD_ARGS"
|
||||
|
||||
# strip --link, --volume and -v args from DOCKER_ARGS
|
||||
local DOCKER_ARGS=$(sed -e "s/^--link=[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--link[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--volume[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" -e "s/^-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
eval set -- "$DOCKER_ARGS"
|
||||
|
||||
declare -a DOCKERFILE_ARGS
|
||||
while true; do
|
||||
case "$1" in
|
||||
--add-host)
|
||||
DOCKERFILE_ARGS+=("--add-host")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--add-host=*)
|
||||
DOCKERFILE_ARGS+=("--add-host" "${1#--add-host=}")
|
||||
shift 1
|
||||
;;
|
||||
--allow)
|
||||
DOCKERFILE_ARGS+=("--allow")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--allow=*)
|
||||
DOCKERFILE_ARGS+=("--allow" "${1#--allow=}")
|
||||
shift 1
|
||||
;;
|
||||
--annotation)
|
||||
DOCKERFILE_ARGS+=("--annotation")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--annotation=*)
|
||||
DOCKERFILE_ARGS+=("--annotation" "${1#--annotation=}")
|
||||
shift 1
|
||||
;;
|
||||
--attest)
|
||||
DOCKERFILE_ARGS+=("--attest")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--attest=*)
|
||||
DOCKERFILE_ARGS+=("--attest" "${1#--attest=}")
|
||||
shift 1
|
||||
;;
|
||||
--build-arg)
|
||||
DOCKERFILE_ARGS+=("--build-arg")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--build-arg=*)
|
||||
DOCKERFILE_ARGS+=("--build-arg" "${1#--build-arg=}")
|
||||
shift 1
|
||||
;;
|
||||
--builder)
|
||||
DOCKERFILE_ARGS+=("--builder")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--builder=*)
|
||||
DOCKERFILE_ARGS+=("--builder" "${1#--builder=}")
|
||||
shift 1
|
||||
;;
|
||||
--cache-from)
|
||||
DOCKERFILE_ARGS+=("--cache-from")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache-from=*)
|
||||
DOCKERFILE_ARGS+=("--cache-from" "${1#--cache-from=}")
|
||||
shift 1
|
||||
;;
|
||||
--cache-to)
|
||||
DOCKERFILE_ARGS+=("--cache-to")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache-to=*)
|
||||
DOCKERFILE_ARGS+=("--cache-to" "${1#--cache-to=}")
|
||||
shift 1
|
||||
;;
|
||||
--call)
|
||||
DOCKERFILE_ARGS+=("--call")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--call=*)
|
||||
DOCKERFILE_ARGS+=("--call" "${1#--call=}")
|
||||
shift 1
|
||||
;;
|
||||
--cgroup-parent)
|
||||
DOCKERFILE_ARGS+=("--cgroup-parent")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cgroup-parent=*)
|
||||
DOCKERFILE_ARGS+=("--cgroup-parent" "${1#--cgroup-parent=}")
|
||||
shift 1
|
||||
;;
|
||||
--label)
|
||||
DOCKERFILE_ARGS+=("--label")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--label=*)
|
||||
DOCKERFILE_ARGS+=("--label" "${1#--label=}")
|
||||
shift 1
|
||||
;;
|
||||
--network)
|
||||
DOCKERFILE_ARGS+=("--network")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--network=*)
|
||||
DOCKERFILE_ARGS+=("--network" "${1#--network=}")
|
||||
shift 1
|
||||
;;
|
||||
--platform)
|
||||
DOCKERFILE_ARGS+=("--platform")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--platform=*)
|
||||
DOCKERFILE_ARGS+=("--platform" "${1#--platform=}")
|
||||
shift 1
|
||||
;;
|
||||
--progress)
|
||||
DOCKERFILE_ARGS+=("--progress")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--progress=*)
|
||||
DOCKERFILE_ARGS+=("--progress" "${1#--progress=}")
|
||||
shift 1
|
||||
;;
|
||||
--provenance)
|
||||
DOCKERFILE_ARGS+=("--provenance")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--provenance=*)
|
||||
DOCKERFILE_ARGS+=("--provenance" "${1#--provenance=}")
|
||||
shift 1
|
||||
;;
|
||||
--sbom)
|
||||
DOCKERFILE_ARGS+=("--sbom")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--sbom=*)
|
||||
DOCKERFILE_ARGS+=("--sbom" "${1#--sbom=}")
|
||||
shift 1
|
||||
;;
|
||||
--secret)
|
||||
DOCKERFILE_ARGS+=("--secret")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--secret=*)
|
||||
DOCKERFILE_ARGS+=("--secret" "${1#--secret=}")
|
||||
shift 1
|
||||
;;
|
||||
--shm-size)
|
||||
DOCKERFILE_ARGS+=("--shm-size")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--shm-size=*)
|
||||
DOCKERFILE_ARGS+=("--shm-size" "${1#--shm-size=}")
|
||||
shift 1
|
||||
;;
|
||||
--ssh)
|
||||
DOCKERFILE_ARGS+=("--platform")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--ssh=*)
|
||||
DOCKERFILE_ARGS+=("--ssh" "${1#--ssh=}")
|
||||
shift 1
|
||||
;;
|
||||
--target)
|
||||
DOCKERFILE_ARGS+=("--target")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--target=*)
|
||||
DOCKERFILE_ARGS+=("--target" "${1#--target=}")
|
||||
shift 1
|
||||
;;
|
||||
--ulimit)
|
||||
DOCKERFILE_ARGS+=("--tag")
|
||||
DOCKERFILE_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--tag=*)
|
||||
DOCKERFILE_ARGS+=("--tag" "${1#--tag=}")
|
||||
shift 1
|
||||
;;
|
||||
--check | -D | --debug | --no-cache)
|
||||
DOCKERFILE_ARGS+=("$1")
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$1" ]]; then
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
eval "$(config_export app "$APP")"
|
||||
"$DOCKER_BIN" image build "${DOCKER_BUILD_LABEL_ARGS[@]}" $DOKKU_GLOBAL_BUILD_ARGS "${ARG_ARRAY[@]}" ${DOKKU_DOCKER_BUILD_OPTS} -t $IMAGE .
|
||||
"$DOCKER_BIN" image build "${DOCKER_BUILD_LABEL_ARGS[@]}" "${DOCKERFILE_ARGS[@]}" --tag $IMAGE .
|
||||
|
||||
plugn trigger ports-set-detected "$APP" "$(fn-builder-dockerfile-get-detect-port-map "$APP" "$IMAGE" "$SOURCECODE_WORK_DIR/Dockerfile")"
|
||||
if fn-plugn-trigger-exists "post-build-dockerfile"; then
|
||||
|
||||
@@ -27,30 +27,224 @@ trigger-builder-nixpacks-builder-build() {
|
||||
|
||||
plugn trigger pre-build "$BUILDER_TYPE" "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
no_cache="$(fn-builder-nixpacks-computed-no-cache "$APP")"
|
||||
NIXPACKS_ARGS=""
|
||||
if [[ "$no_cache" == "true" ]]; then
|
||||
NIXPACKS_ARGS="$NIXPACKS_ARGS --no-cache"
|
||||
fi
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
|
||||
# strip --link, --volume and -v args from DOCKER_ARGS
|
||||
local DOCKER_ARGS=$(sed -e "s/^--link=[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--link[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--volume[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" -e "s/^-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
|
||||
eval "$(config_export app "$APP" --merged)"
|
||||
|
||||
if [[ -f "$SOURCECODE_WORK_DIR/Procfile" ]]; then
|
||||
if procfile-util exists --process-type release; then
|
||||
procfile-util delete --process-type release
|
||||
fi
|
||||
fi
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=" $DOKKU_GLOBAL_BUILD_ARGS"
|
||||
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
eval set -- "$DOCKER_ARGS"
|
||||
|
||||
declare -a NIXPACKS_ARGS
|
||||
while true; do
|
||||
case "$1" in
|
||||
-t | --tag)
|
||||
NIXPACKS_ARGS+=("--tag")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-t=* | --tag=*)
|
||||
if [[ "$1" == "--tag=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--tag" "${1#--tag=}")
|
||||
elif [[ "$1" == "-t=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--tag" "${1#-t=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-i | --install-cmd)
|
||||
NIXPACKS_ARGS+=("--install-cmd")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-i=* | --install-cmd=*)
|
||||
if [[ "$1" == "--install-cmd=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--install-cmd" "${1#--install-cmd=}")
|
||||
elif [[ "$1" == "-i=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--install-cmd" "${1#-i=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-l | --label)
|
||||
NIXPACKS_ARGS+=("--label")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-l=* | --label=*)
|
||||
if [[ "$1" == "--label=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--label" "${1#--label=}")
|
||||
elif [[ "$1" == "-l=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--label" "${1#-l=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-b | --build-cmd)
|
||||
NIXPACKS_ARGS+=("--build-cmd")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-b=* | --build-cmd=*)
|
||||
if [[ "$1" == "--build-cmd=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--build-cmd" "${1#--build-cmd=}")
|
||||
elif [[ "$1" == "-b=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--build-cmd" "${1#-b=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-s | --start-cmd)
|
||||
NIXPACKS_ARGS+=("--start-cmd")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-s=* | --start-cmd=*)
|
||||
if [[ "$1" == "--start-cmd=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--start-cmd" "${1#--start-cmd=}")
|
||||
elif [[ "$1" == "-s=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--start-cmd" "${1#-s=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-p | --pkgs)
|
||||
NIXPACKS_ARGS+=("--pkgs")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-p=* | --pkgs=*)
|
||||
if [[ "$1" == "--pkgs=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--pkgs" "${1#--pkgs=}")
|
||||
elif [[ "$1" == "-p=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--pkgs" "${1#-p=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-a | --apt)
|
||||
NIXPACKS_ARGS+=("--apt")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-a=* | --apt=*)
|
||||
if [[ "$1" == "--apt=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--apt" "${1#--apt=}")
|
||||
elif [[ "$1" == "-a=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--apt" "${1#-a=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-e | --env)
|
||||
NIXPACKS_ARGS+=("--env")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-e=* | --env=*)
|
||||
if [[ "$1" == "--env=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--env" "${1#--env=}")
|
||||
elif [[ "$1" == "-e=*" ]]; then
|
||||
NIXPACKS_ARGS+=("--env" "${1#-e=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
--platform)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--platform=*)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache-key)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache-key=*)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--incremental-cache-image)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--incremental-cache-image=*)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--libs)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--libs=*)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache-from)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache-from=*)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--docker-host)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--docker-host=*)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--add-host)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--add-host=*)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--docker-tls-verify)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--docker-tls-verify=*)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
NIXPACKS_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--no-cache | --inline-cache | --no-error-without-start)
|
||||
NIXPACKS_ARGS+=("$1")
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$1" ]]; then
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
eval "$(config_export app "$APP" --merged)"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
if ! nixpacks build "${DOCKER_BUILD_LABEL_ARGS[@]}" $DOKKU_GLOBAL_BUILD_ARGS "${ARG_ARRAY[@]}" $NIXPACKS_ARGS --name "$IMAGE" "$SOURCECODE_WORK_DIR"; then
|
||||
if ! nixpacks build "${DOCKER_BUILD_LABEL_ARGS[@]}" "${NIXPACKS_ARGS[@]}" --name "$IMAGE" "$SOURCECODE_WORK_DIR"; then
|
||||
dokku_log_warn "Failure building image"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -38,9 +38,6 @@ cmd-builder-nixpacks-report-single() {
|
||||
"--builder-nixpacks-computed-nixpackstoml-path: $(fn-builder-nixpacks-computed-nixpackstoml-path "$APP")"
|
||||
"--builder-nixpacks-global-nixpackstoml-path: $(fn-builder-nixpacks-global-nixpackstoml-path "$APP")"
|
||||
"--builder-nixpacks-nixpackstoml-path: $(fn-builder-nixpacks-nixpackstoml-path "$APP")"
|
||||
"--builder-nixpacks-computed-no-cache: $(fn-builder-nixpacks-computed-no-cache "$APP")"
|
||||
"--builder-nixpacks-global-no-cache: $(fn-builder-nixpacks-global-no-cache "$APP")"
|
||||
"--builder-nixpacks-no-cache: $(fn-builder-nixpacks-no-cache "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
@@ -91,26 +88,3 @@ fn-builder-nixpacks-nixpackstoml-path() {
|
||||
|
||||
fn-plugin-property-get "builder-nixpacks" "$APP" "nixpackstoml-path" ""
|
||||
}
|
||||
|
||||
fn-builder-nixpacks-computed-no-cache() {
|
||||
declare APP="$1"
|
||||
|
||||
file="$(fn-builder-nixpacks-no-cache "$APP")"
|
||||
if [[ "$file" == "" ]]; then
|
||||
file="$(fn-builder-nixpacks-global-no-cache "$APP")"
|
||||
fi
|
||||
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
fn-builder-nixpacks-global-no-cache() {
|
||||
declare APP="$1"
|
||||
|
||||
fn-plugin-property-get "builder-nixpacks" "--global" "no-cache" "false"
|
||||
}
|
||||
|
||||
fn-builder-nixpacks-no-cache() {
|
||||
declare APP="$1"
|
||||
|
||||
fn-plugin-property-get "builder-nixpacks" "$APP" "no-cache" ""
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ cmd-builder-nixpacks-set() {
|
||||
declare cmd="builder-nixpacks:set"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1" KEY="$2" VALUE="$3"
|
||||
local VALID_KEYS=("nixpackstoml-path" "no-cache")
|
||||
local VALID_KEYS=("nixpackstoml-path")
|
||||
[[ "$APP" == "--global" ]] || verify_app_name "$APP"
|
||||
|
||||
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
|
||||
|
||||
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
|
||||
dokku_log_fail "Invalid key specified, valid keys include: nixpackstoml-path, no-cache"
|
||||
dokku_log_fail "Invalid key specified, valid keys include: nixpackstoml-path"
|
||||
fi
|
||||
|
||||
if [[ -n "$VALUE" ]]; then
|
||||
|
||||
@@ -38,28 +38,242 @@ trigger-builder-pack-builder-build() {
|
||||
plugn trigger pre-build "$BUILDER_TYPE" "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" --env=TRACE=true "
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
[[ "$DOKKU_TRACE" ]] && DOCKER_ARGS+=" --env=TRACE=true "
|
||||
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
|
||||
eval set -- "$DOCKER_ARGS"
|
||||
|
||||
declare -a PACK_ARGS
|
||||
while true; do
|
||||
case "$1" in
|
||||
--volume=* | -v=*)
|
||||
PACK_ARGS+=("$1")
|
||||
shift
|
||||
-b | --buildpack)
|
||||
PACK_ARGS+=("--buildpack")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-b=* | --buildpack=*)
|
||||
if [[ "$1" == "--buildpack=*" ]]; then
|
||||
PACK_ARGS+=("--buildpack" "${1#--buildpack=}")
|
||||
elif [[ "$1" == "-b=*" ]]; then
|
||||
PACK_ARGS+=("--buildpack" "${1#-b=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-r | --buildpack-registry)
|
||||
PACK_ARGS+=("--buildpack-registry")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-r=* | --buildpack-registry=*)
|
||||
if [[ "$1" == "--buildpack-registry=*" ]]; then
|
||||
PACK_ARGS+=("--buildpack-registry" "${1#--buildpack-registry=}")
|
||||
elif [[ "$1" == "-r=*" ]]; then
|
||||
PACK_ARGS+=("--buildpack-registry" "${1#-r=}")
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
-e | --env)
|
||||
PACK_ARGS+=("--env")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-e=* | --env=*)
|
||||
if [[ "$1" == "--env=*" ]]; then
|
||||
PACK_ARGS+=("--env" "${1#--env=}")
|
||||
elif [[ "$1" == "-e=*" ]]; then
|
||||
PACK_ARGS+=("--env" "${1#-e=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
-t | --tag)
|
||||
PACK_ARGS+=("--tag")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-t=* | --tag=*)
|
||||
if [[ "$1" == "--tag=*" ]]; then
|
||||
PACK_ARGS+=("--tag" "${1#--tag=}")
|
||||
elif [[ "$1" == "-t=*" ]]; then
|
||||
PACK_ARGS+=("--tag" "${1#-t=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
--volume | -v)
|
||||
PACK_ARGS+=("--volume")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--volume=* | -v=*)
|
||||
if [[ "$1" == "--volume=*" ]]; then
|
||||
PACK_ARGS+=("--volume" "${1#--volume=}")
|
||||
elif [[ "$1" == "-v=*" ]]; then
|
||||
PACK_ARGS+=("--volume" "${1#-v=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
--cache)
|
||||
PACK_ARGS+=("--cache")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache=*)
|
||||
PACK_ARGS+=("--cache" "${1#--cache=}")
|
||||
shift 1
|
||||
;;
|
||||
--cache-image)
|
||||
PACK_ARGS+=("--cache-image")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache-image=*)
|
||||
PACK_ARGS+=("--cache-image" "${1#--cache-image=}")
|
||||
shift 1
|
||||
;;
|
||||
--creation-time)
|
||||
PACK_ARGS+=("--creation-time")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--creation-time=*)
|
||||
PACK_ARGS+=("--creation-time" "${1#--creation-time=}")
|
||||
shift 1
|
||||
;;
|
||||
--env-file)
|
||||
PACK_ARGS+=("--env-file")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--env-file=*)
|
||||
PACK_ARGS+=("--env-file" "${1#--env-file=}")
|
||||
shift 1
|
||||
;;
|
||||
--extension)
|
||||
PACK_ARGS+=("--extension")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--extension=*)
|
||||
PACK_ARGS+=("--extension" "${1#--extension=}")
|
||||
shift 1
|
||||
;;
|
||||
--gid)
|
||||
PACK_ARGS+=("--gid")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--gid=*)
|
||||
PACK_ARGS+=("--gid" "${1#--gid=}")
|
||||
shift 1
|
||||
;;
|
||||
--insecure-registry)
|
||||
PACK_ARGS+=("--insecure-registry")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--insecure-registry=*)
|
||||
PACK_ARGS+=("--insecure-registry" "${1#--insecure-registry=}")
|
||||
shift 1
|
||||
;;
|
||||
--lifecycle-image)
|
||||
PACK_ARGS+=("--lifecycle-image")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--lifecycle-image=*)
|
||||
PACK_ARGS+=("--lifecycle-image" "${1#--lifecycle-image=}")
|
||||
shift 1
|
||||
;;
|
||||
--network)
|
||||
PACK_ARGS+=("--network")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--network=*)
|
||||
PACK_ARGS+=("--network" "${1#--network=}")
|
||||
shift 1
|
||||
;;
|
||||
--platform)
|
||||
PACK_ARGS+=("--platform")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--platform=*)
|
||||
PACK_ARGS+=("--platform" "${1#--platform=}")
|
||||
shift 1
|
||||
;;
|
||||
--post-buildpack)
|
||||
PACK_ARGS+=("--post-buildpack")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--post-buildpack=*)
|
||||
PACK_ARGS+=("--post-buildpack" "${1#--post-buildpack=}")
|
||||
shift 1
|
||||
;;
|
||||
--pre-buildpack)
|
||||
PACK_ARGS+=("--pre-buildpack")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--pre-buildpack=*)
|
||||
PACK_ARGS+=("--pre-buildpack" "${1#--pre-buildpack=}")
|
||||
shift 1
|
||||
;;
|
||||
--previous-image)
|
||||
PACK_ARGS+=("--previous-image")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--previous-image=*)
|
||||
PACK_ARGS+=("--previous-image" "${1#--previous-image=}")
|
||||
shift 1
|
||||
;;
|
||||
--pull-policy)
|
||||
PACK_ARGS+=("--pull-policy")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--pull-policy=*)
|
||||
PACK_ARGS+=("--pull-policy" "${1#--pull-policy=}")
|
||||
shift 1
|
||||
;;
|
||||
--run-image)
|
||||
PACK_ARGS+=("--run-image")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--run-image=*)
|
||||
PACK_ARGS+=("--run-image" "${1#--run-image=}")
|
||||
shift 1
|
||||
;;
|
||||
--uid)
|
||||
PACK_ARGS+=("--uid")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--uid=*)
|
||||
PACK_ARGS+=("--uid" "${1#--uid=}")
|
||||
shift 1
|
||||
;;
|
||||
--workspace)
|
||||
PACK_ARGS+=("--workspace")
|
||||
PACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--workspace=*)
|
||||
PACK_ARGS+=("--workspace" "${1#--workspace=}")
|
||||
shift 1
|
||||
;;
|
||||
--clear-cache | --disable-system-buildpacks | --publish | --trust-builder | --trust-extra-buildpacks | --userns-host)
|
||||
PACK_ARGS+=("$1")
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$1" ]]; then
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
break
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -27,30 +27,106 @@ trigger-builder-railpack-builder-build() {
|
||||
|
||||
plugn trigger pre-build "$BUILDER_TYPE" "$APP" "$SOURCECODE_WORK_DIR"
|
||||
|
||||
no_cache="$(fn-builder-railpack-computed-no-cache "$APP")"
|
||||
RAILPACK_ARGS=""
|
||||
if [[ "$no_cache" == "true" ]]; then
|
||||
RAILPACK_ARGS="$RAILPACK_ARGS --no-cache"
|
||||
fi
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
|
||||
# strip --link, --volume and -v args from DOCKER_ARGS
|
||||
local DOCKER_ARGS=$(sed -e "s/^--link=[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--link[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--volume=[[:graph:]]\+[[:blank:]]\?//g" -e "s/^--volume[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" -e "s/^-v[[:blank:]]\?[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS")
|
||||
declare -a ARG_ARRAY
|
||||
eval "ARG_ARRAY=($DOCKER_ARGS)"
|
||||
|
||||
eval "$(config_export app "$APP" --merged)"
|
||||
|
||||
if [[ -f "$SOURCECODE_WORK_DIR/Procfile" ]]; then
|
||||
if procfile-util exists --process-type release; then
|
||||
procfile-util delete --process-type release
|
||||
fi
|
||||
fi
|
||||
|
||||
local DOCKER_ARGS=$(: | plugn trigger docker-args-build "$APP" "$BUILDER_TYPE")
|
||||
DOCKER_ARGS+=$(: | plugn trigger docker-args-process-build "$APP" "$BUILDER_TYPE")
|
||||
|
||||
DOCKER_ARGS=" $DOCKER_ARGS "
|
||||
eval set -- "$DOCKER_ARGS"
|
||||
|
||||
declare -a RAILPACK_ARGS
|
||||
while true; do
|
||||
case "$1" in
|
||||
--platform)
|
||||
RAILPACK_ARGS+=("--platform")
|
||||
RAILPACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--platform=*)
|
||||
RAILPACK_ARGS+=("--platform" "${1#--platform=}")
|
||||
shift 1
|
||||
;;
|
||||
--progress)
|
||||
RAILPACK_ARGS+=("--progress")
|
||||
RAILPACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--progress=*)
|
||||
RAILPACK_ARGS+=("--progress" "${1#--progress=}")
|
||||
shift 1
|
||||
;;
|
||||
--cache-key)
|
||||
RAILPACK_ARGS+=("--cache-key")
|
||||
RAILPACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--cache-key=*)
|
||||
RAILPACK_ARGS+=("--cache-key" "${1#--cache-key=}")
|
||||
shift 1
|
||||
;;
|
||||
-e | --env)
|
||||
RAILPACK_ARGS+=("--env")
|
||||
RAILPACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
-e=* | --env=*)
|
||||
if [[ "$1" == "--env=*" ]]; then
|
||||
RAILPACK_ARGS+=("--env" "${1#--env=}")
|
||||
elif [[ "$1" == "--e=*" ]]; then
|
||||
RAILPACK_ARGS+=("--env" "${1#-e=}")
|
||||
fi
|
||||
shift 1
|
||||
;;
|
||||
--previous)
|
||||
RAILPACK_ARGS+=("--previous")
|
||||
RAILPACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--previous=*)
|
||||
RAILPACK_ARGS+=("--previous" "${1#--previous=}")
|
||||
shift 1
|
||||
;;
|
||||
--build-cmd)
|
||||
RAILPACK_ARGS+=("--build-cmd")
|
||||
RAILPACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--build-cmd=*)
|
||||
RAILPACK_ARGS+=("--build-cmd" "${1#--build-cmd=}")
|
||||
shift 1
|
||||
;;
|
||||
--start-cmd)
|
||||
RAILPACK_ARGS+=("--start-cmd")
|
||||
RAILPACK_ARGS+=("$2")
|
||||
shift 2
|
||||
;;
|
||||
--start-cmd=*)
|
||||
RAILPACK_ARGS+=("--start-cmd" "${1#--start-cmd=}")
|
||||
shift 1
|
||||
;;
|
||||
---show-plan | --error-missing-start)
|
||||
RAILPACK_ARGS+=("$1")
|
||||
shift 1
|
||||
;;
|
||||
*)
|
||||
if [[ -n "$1" ]]; then
|
||||
shift
|
||||
continue
|
||||
fi
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
eval "$(config_export app "$APP" --merged)"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
if ! railpack build "${ARG_ARRAY[@]}" $RAILPACK_ARGS --name "$IMAGE-build" "$SOURCECODE_WORK_DIR"; then
|
||||
if ! railpack build "${RAILPACK_ARGS[@]}" --name "$IMAGE-build" "$SOURCECODE_WORK_DIR"; then
|
||||
dokku_log_warn "Failure building image"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -38,9 +38,6 @@ cmd-builder-railpack-report-single() {
|
||||
"--builder-railpack-computed-railpackjson-path: $(fn-builder-railpack-computed-railpackjson-path "$APP")"
|
||||
"--builder-railpack-global-railpackjson-path: $(fn-builder-railpack-global-railpackjson-path "$APP")"
|
||||
"--builder-railpack-railpackjson-path: $(fn-builder-railpack-railpackjson-path "$APP")"
|
||||
"--builder-railpack-computed-no-cache: $(fn-builder-railpack-computed-no-cache "$APP")"
|
||||
"--builder-railpack-global-no-cache: $(fn-builder-railpack-global-no-cache "$APP")"
|
||||
"--builder-railpack-no-cache: $(fn-builder-railpack-no-cache "$APP")"
|
||||
)
|
||||
|
||||
if [[ -z "$INFO_FLAG" ]]; then
|
||||
@@ -91,26 +88,3 @@ fn-builder-railpack-railpackjson-path() {
|
||||
|
||||
fn-plugin-property-get "builder-railpack" "$APP" "railpackjson-path" ""
|
||||
}
|
||||
|
||||
fn-builder-railpack-computed-no-cache() {
|
||||
declare APP="$1"
|
||||
|
||||
file="$(fn-builder-railpack-no-cache "$APP")"
|
||||
if [[ "$file" == "" ]]; then
|
||||
file="$(fn-builder-railpack-global-no-cache "$APP")"
|
||||
fi
|
||||
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
fn-builder-railpack-global-no-cache() {
|
||||
declare APP="$1"
|
||||
|
||||
fn-plugin-property-get "builder-railpack" "--global" "no-cache" "false"
|
||||
}
|
||||
|
||||
fn-builder-railpack-no-cache() {
|
||||
declare APP="$1"
|
||||
|
||||
fn-plugin-property-get "builder-railpack" "$APP" "no-cache" ""
|
||||
}
|
||||
|
||||
@@ -9,13 +9,13 @@ cmd-builder-railpack-set() {
|
||||
declare cmd="builder-railpack:set"
|
||||
[[ "$1" == "$cmd" ]] && shift 1
|
||||
declare APP="$1" KEY="$2" VALUE="$3"
|
||||
local VALID_KEYS=("railpackjson-path" "no-cache")
|
||||
local VALID_KEYS=("railpackjson-path")
|
||||
[[ "$APP" == "--global" ]] || verify_app_name "$APP"
|
||||
|
||||
[[ -z "$KEY" ]] && dokku_log_fail "No key specified"
|
||||
|
||||
if ! fn-in-array "$KEY" "${VALID_KEYS[@]}"; then
|
||||
dokku_log_fail "Invalid key specified, valid keys include: railpackjson-path, no-cache"
|
||||
dokku_log_fail "Invalid key specified, valid keys include: railpackjson-path"
|
||||
fi
|
||||
|
||||
if [[ -n "$VALUE" ]]; then
|
||||
|
||||
@@ -45,10 +45,11 @@ git add .
|
||||
|
||||
[[ -x pre-commit ]] && ./pre-commit "$REMOTE" "$REPO"
|
||||
git commit -m 'initial commit'
|
||||
current_branch="$(git rev-parse --abbrev-ref HEAD)"
|
||||
if [[ "$SHOULD_FAIL" == true ]]; then
|
||||
git push target "master:$BRANCH" && succeeded git-push
|
||||
git push target "$current_branch:$BRANCH" && succeeded git-push
|
||||
else
|
||||
git push target "master:$BRANCH" || failed git-push
|
||||
git push target "$current_branch:$BRANCH" || failed git-push
|
||||
fi
|
||||
if [[ -x post-deploy ]]; then
|
||||
./post-deploy "$REMOTE" "$REPO" || failed post-deploy
|
||||
|
||||
@@ -486,10 +486,15 @@ teardown() {
|
||||
|
||||
@test "(config) global config (dockerfile)" {
|
||||
run deploy_app dockerfile
|
||||
run /bin/bash -c "dokku run $TEST_APP env | grep -E '^global_test=true'"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku run $TEST_APP env"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
assert_output_contains "global_test=true"
|
||||
}
|
||||
|
||||
@test "(config) config:show" {
|
||||
|
||||
Reference in New Issue
Block a user