Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Improve docker image README
- Fix unnecessary/missing newline escapes
- Remove double whitespace between parameters
- 2-space indent for extra lines in image build commands
  • Loading branch information
jamezrin authored Jul 26, 2023
commit f441642b00d4b938d93a6a0d10e657a7b6059976
27 changes: 14 additions & 13 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This Dockerfile can create images for the following targets, each named after th

In order to build a new image, run the following docker command.
```
docker build --tag <your_image_name> --target <target_name> <path/to/dockerfile>
docker build --tag <your_image_name> --target <target_name> <path/to/dockerfile>
```
---
> **Note:** Docker must be configured to use [BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/) in order for images to build properly!
Expand Down Expand Up @@ -54,17 +54,17 @@ docker build --tag <your_image_name> \
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 .
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 \
--tag my-other-dbt \
--target dbt-bigquery \
--build-arg dbt_bigquery_ref=dbt-bigquery@v1.0.0b1 \
--build-arg dbt_core_ref=dbt-core@0.21.latest \
--build-arg dbt_core_ref=dbt-core@0.21.latest \
.
```

Expand All @@ -87,27 +87,28 @@ There are a few special cases worth noting:
docker build --tag my_dbt \
--target dbt-postgres \
--build-arg dbt_postgres_ref=dbt-core@1.0.0b1 \
<path/to/dockerfile> \
```
<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> \
```
<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:
```
docker run \
--network=host
--mount type=bind,source=path/to/project,target=/usr/app \
--mount type=bind,source=path/to/profiles.yml,target=/root/.dbt/profiles.yml \
my-dbt \
ls
--network=host \
--mount type=bind,source=path/to/project,target=/usr/app \
--mount type=bind,source=path/to/profiles.yml,target=/root/.dbt/profiles.yml \
my-dbt \
ls
```
---
**Notes:**
Expand Down