From 424f3d218a215ebcc19227c051767f20acb21c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Mart=C3=ADnez=20Rinc=C3=B3n?= Date: Fri, 18 Aug 2023 21:14:59 +0200 Subject: [PATCH] Improve docker image README (#8212) * Improve docker image README - Fix unnecessary/missing newline escapes - Remove double whitespace between parameters - 2-space indent for extra lines in image build commands * Add changelog entry for #8212 --- .changes/unreleased/Docs-20230728-193438.yaml | 6 +++++ docker/README.md | 27 ++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) create mode 100644 .changes/unreleased/Docs-20230728-193438.yaml diff --git a/.changes/unreleased/Docs-20230728-193438.yaml b/.changes/unreleased/Docs-20230728-193438.yaml new file mode 100644 index 00000000000..612b15e81b9 --- /dev/null +++ b/.changes/unreleased/Docs-20230728-193438.yaml @@ -0,0 +1,6 @@ +kind: Docs +body: Fix newline escapes and improve formatting in docker README +time: 2023-07-28T19:34:38.351042747+02:00 +custom: + Author: jamezrin + Issue: "8211" diff --git a/docker/README.md b/docker/README.md index 7a48010b7d3..f735c312d15 100644 --- a/docker/README.md +++ b/docker/README.md @@ -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 --target +docker build --tag --target ``` --- > **Note:** Docker must be configured to use [BuildKit](https://docs.docker.com/develop/develop-images/build_enhancements/) in order for images to build properly! @@ -54,17 +54,17 @@ docker build --tag \ 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 \ . ``` @@ -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 \ - \ - ``` + +``` * 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 \ - \ - ``` + +``` + 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:**