-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eliminate references to adapter repos as they will be handled in thos…
…e repos
- Loading branch information
1 parent
e8fa01b
commit 078848d
Showing
1 changed file
with
9 additions
and
60 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,9 @@ This docker file is suitable for building dbt Docker images locally or using wit | |
## Building an image: | ||
This Dockerfile can create images for the following targets, each named after the database they support: | ||
* `dbt-core` _(no db-adapter support)_ | ||
* `dbt-postgres` | ||
* `dbt-redshift` | ||
* `dbt-bigquery` | ||
* `dbt-snowflake` | ||
* `dbt-spark` | ||
* `dbt-third-party` _(requires additional build-arg)_ | ||
* `dbt-all` _(installs all of the above in a single image)_ | ||
|
||
For platform-specific images, please refer to that platform's repository (eg. `dbt-labs/dbt-postgres`) | ||
|
||
In order to build a new image, run the following docker command. | ||
``` | ||
|
@@ -22,53 +18,27 @@ docker build --tag <your_image_name> --target <target_name> <path/to/dockerfile> | |
--- | ||
|
||
By default the images will be populated with the most recent release of `dbt-core` and whatever database adapter you select. If you need to use a different version you can specify it by git ref using the `--build-arg` flag: | ||
By default the images will be populated with `dbt-core` on `main`. | ||
If you need to use a different version you can specify it by git ref (tag, branch, sha) using the `--build-arg` flag: | ||
``` | ||
docker build --tag <your_image_name> \ | ||
--target <target_name> \ | ||
--build-arg <arg_name>=<git_ref> \ | ||
--build-arg commit_ref=<git_ref> \ | ||
<path/to/dockerfile> | ||
``` | ||
valid arg names for versioning are: | ||
* `dbt_core_ref` | ||
* `dbt_postgres_ref` | ||
* `dbt_redshift_ref` | ||
* `dbt_bigquery_ref` | ||
* `dbt_snowflake_ref` | ||
* `dbt_spark_ref` | ||
|
||
--- | ||
>**NOTE:** Only override a _single_ build arg for each build. Using multiple overrides may lead to a non-functioning image. | ||
|
||
--- | ||
|
||
If you wish to build an image with a third-party adapter you can use the `dbt-third-party` target. This target requires you provide a path to the adapter that can be processed by `pip` by using the `dbt_third_party` build arg: | ||
If you wish to build an image with a third-party adapter you can use the `dbt-third-party` target. | ||
This target requires you provide a path to the adapter that can be processed by `pip` by using the `dbt_third_party` build arg: | ||
``` | ||
docker build --tag <your_image_name> \ | ||
--target dbt-third-party \ | ||
--build-arg dbt_third_party=<pip_parsable_install_string> \ | ||
<path/to/dockerfile> | ||
``` | ||
This can also be combined with the `commit_ref` build arg to specify a version of `dbt-core`. | ||
|
||
### Examples: | ||
To build an image named "my-dbt" that supports redshift using the latest releases: | ||
``` | ||
cd dbt-core/docker | ||
docker build --tag my-dbt --target dbt-redshift . | ||
``` | ||
|
||
To build an image named "my-other-dbt" that supports bigquery using `dbt-core` version 0.21.latest and the bigquery adapter version 1.0.0b1: | ||
``` | ||
cd dbt-core/docker | ||
docker build \ | ||
--tag my-other-dbt \ | ||
--target dbt-bigquery \ | ||
--build-arg [email protected] \ | ||
--build-arg [email protected] \ | ||
. | ||
``` | ||
|
||
To build an image named "my-third-party-dbt" that uses [Materilize third party adapter](https://github.com/MaterializeInc/materialize/tree/main/misc/dbt-materialize) and the latest release of `dbt-core`: | ||
To build an image named "my-third-party-dbt" that uses the latest release of [Materialize third party adapter](https://github.com/MaterializeInc/materialize/tree/main/misc/dbt-materialize) and the latest dev version of `dbt-core`: | ||
``` | ||
cd dbt-core/docker | ||
docker build --tag my-third-party-dbt \ | ||
|
@@ -78,27 +48,6 @@ docker build --tag my-third-party-dbt \ | |
``` | ||
|
||
|
||
## Special cases | ||
There are a few special cases worth noting: | ||
* The `dbt-spark` database adapter comes in three different versions named `PyHive`, `ODBC`, and the default `all`. If you wish to overide this you can use the `--build-arg` flag with the value of `dbt_spark_version=<version_name>`. See the [docs](https://docs.getdbt.com/reference/warehouse-profiles/spark-profile) for more information. | ||
|
||
``` | ||
docker build --tag my_dbt \ | ||
--target dbt-postgres \ | ||
--build-arg [email protected] \ | ||
<path/to/dockerfile> | ||
``` | ||
|
||
* If you need to build against another architecture (linux/arm64 in this example) you can overide the `build_for` build arg: | ||
``` | ||
docker build --tag my_dbt \ | ||
--target dbt-postgres \ | ||
--build-arg build_for=linux/arm64 \ | ||
<path/to/dockerfile> | ||
``` | ||
|
||
Supported architectures can be found in the python docker [dockerhub page](https://hub.docker.com/_/python). | ||
|
||
## Running an image in a container: | ||
The `ENTRYPOINT` for this Dockerfile is the command `dbt` so you can bind-mount your project to `/usr/app` and use dbt as normal: | ||
``` | ||
|