Tar and Zip Archives¶
Initializing an app repository from an archive file¶
New
Introduced in 0.24.0
A Dokku app repository can be initialized or updated from the contents of an archive file via the git:from-archive command. This is an excellent way of tracking changes when deploying pre-built binary archives, such as java jars or go binaries. This can also be useful when deploying directly from a GitHub repository at a specific commit.
dokku git:from-archive node-js-app https://github.com/dokku/smoke-test-app/releases/download/2.0.0/smoke-test-app.tar
In the above example, Dokku will build the app as if the repository contained the extracted contents of the specified archive file.
The archive url must be an http:// or https:// url, and any redirects must also use one of those protocols. Any other value - with the exception of --, described below - results in an error before the archive is fetched.
Triggering a build with the same archive file multiple times will result in Dokku exiting 0 early as there will be no changes detected.
The git:from-archive command can optionally take a git user.name and user.email argument (in that order) to customize the author. If the arguments are left empty, they will fallback to Dokku and automated@dokku.sh, respectively.
dokku git:from-archive node-js-app https://github.com/dokku/smoke-test-app/releases/download/2.0.0/smoke-test-app.tar "Camila" "camila@example.com"
The default archive type is always set to .tar. To use a different archive type, specify the --archive-type flag. Failure to do so will result in a failure to extract the archive. Valid archive types are tar, tar.gz, and zip. Any other value results in an error before the archive is fetched.
dokku git:from-archive --archive-type zip node-js-app https://github.com/dokku/smoke-test-app/archive/2.0.0.zip "Camila" "camila@example.com"
Finally, if the archive url is specified as --, the archive will be fetched from stdin.
curl -sSL https://github.com/dokku/smoke-test-app/releases/download/2.0.0/smoke-test-app.tar | dokku git:from-archive node-js-app --
Archive Safety¶
Archive contents are validated before extraction to prevent path traversal and symlink escape attacks. Archives containing absolute paths, parent directory traversal entries (..), or symlinks pointing outside the extraction directory are rejected.
The following limits can be configured via global git properties, and must be whole numbers:
archive-max-size- maximum archive size in bytes (default:1073741824, 1 GiB)archive-max-files- maximum number of entries in an archive (default:10000)
Unset a property to restore the default:
The current values can be inspected via the global git report: