-
Notifications
You must be signed in to change notification settings - Fork 238
Add docker release to the full release process for final releases #1004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
3186972
add docker release to release pipeline
mikealfare 446bb0c
changelog
mikealfare 43e100c
Merge branch 'refs/heads/main' into config/docker-release
mikealfare 548f7df
update docker release to align with other adapters, add dev docker
mikealfare 8e31cc4
update docker release to align with other adapters, add dev docker
mikealfare e9420b5
remove defaulted input for docker package, override default for docke…
mikealfare acdc453
point back to main
mikealfare fb197f0
remove changie entry
mikealfare fc7de15
fix docker release dependent steps
mikealfare d9d27b0
only release docker when not testing, allow to only release to docker
emmyoop c685f9d
Merge branch 'refs/heads/main' into config/docker-release
mikealfare a82838a
remove dev container
mikealfare c1f7359
clean up test script
mikealfare 1d9fe5d
Update docker-release/Dockerfile
mikealfare 6c544c6
rename the spark Dockerfile to make space for the release Dockerfile
mikealfare 52ad6cb
move the release Dockerfile into ./docker
mikealfare 5f3e52d
move the release Dockerfile into ./docker
mikealfare 2326b2d
move the release Dockerfile into ./docker
mikealfare b87999b
move the release Dockerfile into ./docker
mikealfare 85c9d9f
Merge branch 'main' into config/docker-release
mikealfare 28b8aff
Merge branch 'main' into config/docker-release
mikealfare d49184f
Merge branch 'main' into config/docker-release
mikealfare 78b9a36
Merge branch 'main' into config/docker-release
mikealfare 0680722
Merge branch 'main' into config/docker-release
mikealfare dcdab2d
Merge branch 'main' into config/docker-release
mikealfare 29011fd
Merge branch 'main' into config/docker-release
mikealfare 4674f9f
point to dev branch for now
mikealfare 74f8c78
Merge remote-tracking branch 'origin/config/docker-release' into conf…
mikealfare c7731c3
point back to main
mikealfare 562bebd
remove unused script
mikealfare File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
kind: Under the Hood | ||
body: Automate the Docker release as part of the PyPI release | ||
time: 2024-04-05T18:56:09.981637-04:00 | ||
custom: | ||
Author: mikealfare | ||
Issue: "1004" |
This file contains hidden or 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 |
---|---|---|
@@ -1,8 +1,22 @@ | ||
version: 2 | ||
updates: | ||
# python dependencies | ||
- package-ecosystem: "pip" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
rebase-strategy: "disabled" | ||
- package-ecosystem: "docker" | ||
directory: "/docker" | ||
schedule: | ||
interval: "weekly" | ||
rebase-strategy: "disabled" | ||
- package-ecosystem: "docker" | ||
directory: "/docker-dev" | ||
schedule: | ||
interval: "weekly" | ||
rebase-strategy: "disabled" | ||
- package-ecosystem: "docker" | ||
directory: "/docker-release" | ||
schedule: | ||
interval: "weekly" | ||
rebase-strategy: "disabled" |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# this image does not get published, it is intended for local development only, see `Makefile` for usage | ||
FROM ubuntu:22.04 as base | ||
|
||
# prevent python installation from asking for time zone region | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# add python repository | ||
RUN apt-get update \ | ||
&& apt-get install -y software-properties-common=0.99.22.9 \ | ||
&& add-apt-repository -y ppa:deadsnakes/ppa \ | ||
&& apt-get clean \ | ||
&& rm -rf \ | ||
/var/lib/apt/lists/* \ | ||
/tmp/* \ | ||
/var/tmp/* | ||
|
||
# install python | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends \ | ||
build-essential=12.9ubuntu3 \ | ||
gcc=4:11.2.0-1ubuntu1 \ | ||
git-all=1:2.34.1-1ubuntu1.10 \ | ||
libsasl2-dev=2.1.27+dfsg2-3ubuntu1.2 \ | ||
python3.10=3.10.12-1~22.04.3 \ | ||
python3.10-dev=3.10.12-1~22.04.3 \ | ||
python3.10-venv=3.10.12-1~22.04.3 \ | ||
python3-distutils=3.10.8-1~22.04 \ | ||
python3-pip=22.0.2+dfsg-1ubuntu0.4 \ | ||
python3-wheel=0.37.1-2ubuntu0.22.04.1 \ | ||
unixodbc-dev=2.3.9-5ubuntu0.1 \ | ||
&& apt-get clean \ | ||
&& rm -rf \ | ||
/var/lib/apt/lists/* \ | ||
/tmp/* \ | ||
/var/tmp/* | ||
|
||
# update the default system interpreter to the newly installed version | ||
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 | ||
|
||
# install python dependencies | ||
RUN python3 -m pip install --upgrade --no-cache-dir \ | ||
"beartype==0.17.2" \ | ||
"dagger-io==0.10.3" \ | ||
"python-dotenv==1.0.1" | ||
|
||
|
||
FROM base as dbt-spark-dev | ||
|
||
HEALTHCHECK CMD python3 --version || exit 1 | ||
|
||
# send stdout/stderr to terminal | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# setup mount for local code | ||
WORKDIR /opt/code | ||
VOLUME /opt/code | ||
|
||
# create a virtual environment | ||
RUN python3 -m venv /opt/venv |
mikealfare marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# this image gets published to GHCR for production use | ||
ARG py_version=3.10.7 | ||
mikealfare marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
FROM python:$py_version-slim-bullseye as base | ||
|
||
RUN apt-get update \ | ||
&& apt-get dist-upgrade -y \ | ||
&& apt-get install -y --no-install-recommends \ | ||
build-essential=12.9 \ | ||
ca-certificates=20210119 \ | ||
gcc=4:10.2.1-1 \ | ||
git=1:2.30.2-1+deb11u2 \ | ||
libpq-dev=13.14-0+deb11u1 \ | ||
libsasl2-dev=2.1.27+dfsg-2.1+deb11u1 \ | ||
make=4.3-4.1 \ | ||
openssh-client=1:8.4p1-5+deb11u3 \ | ||
python-dev-is-python2=2.7.18-9 \ | ||
software-properties-common=0.96.20.2-2.1 \ | ||
unixodbc-dev=2.3.6-0.1+b1 \ | ||
&& apt-get clean \ | ||
&& rm -rf \ | ||
/var/lib/apt/lists/* \ | ||
/tmp/* \ | ||
/var/tmp/* | ||
|
||
ENV PYTHONIOENCODING=utf-8 | ||
ENV LANG=C.UTF-8 | ||
|
||
RUN python -m pip install --upgrade "pip==24.0" "setuptools==69.2.0" "wheel==0.43.0" --no-cache-dir | ||
|
||
|
||
FROM base as dbt-spark | ||
|
||
ARG commit_ref=main | ||
ARG extras=all | ||
|
||
HEALTHCHECK CMD dbt --version || exit 1 | ||
|
||
WORKDIR /usr/app/dbt/ | ||
ENTRYPOINT ["dbt"] | ||
|
||
RUN python -m pip install --no-cache-dir "dbt-spark[${extras}] @ git+https://github.com/dbt-labs/dbt-spark@${commit_ref}" |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Docker for dbt | ||
This docker file is suitable for building dbt Docker images locally or using with CI/CD to automate populating a container registry. | ||
|
||
|
||
## Building an image: | ||
This Dockerfile can create images for the following target: `dbt-spark` | ||
|
||
In order to build a new image, run the following docker command. | ||
```shell | ||
docker build --tag <your_image_name> --target dbt-spark <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! | ||
|
||
--- | ||
|
||
By default the image will be populated with the latest version of `dbt-spark` on `main`. | ||
If you need to use a different version you can specify it by git ref using the `--build-arg` flag: | ||
```shell | ||
docker build --tag <your_image_name> \ | ||
--target dbt-spark \ | ||
--build-arg commit_ref=<commit_ref> \ | ||
<path/to/dockerfile> | ||
``` | ||
|
||
### Examples: | ||
To build an image named "my-dbt" that supports Snowflake using the latest releases: | ||
```shell | ||
cd dbt-core/docker | ||
docker build --tag my-dbt --target dbt-spark . | ||
``` | ||
|
||
To build an image named "my-other-dbt" that supports Snowflake using the adapter version 1.0.0b1: | ||
```shell | ||
cd dbt-core/docker | ||
docker build \ | ||
--tag my-other-dbt \ | ||
--target dbt-spark \ | ||
--build-arg commit_ref=v1.0.0b1 \ | ||
. | ||
``` | ||
|
||
## 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 override this you can use the `--build-arg` flag with the value of `extras=<extras_name>`. | ||
See the [docs](https://docs.getdbt.com/reference/warehouse-profiles/spark-profile) for more information. | ||
```shell | ||
docker build --tag my_dbt \ | ||
--target dbt-spark \ | ||
--build-arg commit_ref=v1.0.0b1 \ | ||
--build-arg extras=PyHive \ | ||
<path/to/dockerfile> | ||
``` | ||
|
||
## 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: | ||
```shell | ||
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 | ||
``` | ||
--- | ||
**Notes:** | ||
* Bind-mount sources _must_ be an absolute path | ||
* You may need to make adjustments to the docker networking setting depending on the specifics of your data warehouse/database host. | ||
|
||
--- |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# - VERY rudimentary test script to run latest + specific branch image builds and test them all by running `--version` | ||
# TODO: create a real test suite | ||
|
||
clear \ | ||
&& echo "\n\n"\ | ||
"########################################\n"\ | ||
"##### Testing dbt-spark latest #####\n"\ | ||
"########################################\n"\ | ||
&& docker build --tag dbt-spark \ | ||
--target dbt-spark \ | ||
docker \ | ||
&& docker run dbt-spark --version \ | ||
\ | ||
&& echo "\n\n"\ | ||
"#########################################\n"\ | ||
"##### Testing dbt-spark-1.0.0b1 #####\n"\ | ||
"#########################################\n"\ | ||
&& docker build --tag dbt-spark-1.0.0b1 \ | ||
--target dbt-spark \ | ||
--build-arg commit_ref=v1.0.0b1 \ | ||
docker \ | ||
&& docker run dbt-spark-1.0.0b1 --version |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.