-
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.
Simplify docker release process in the release pipeline (#9928)
* simplify dockerfile, eliminate references to adapter repos as they will be handled in those repos * keep dbt-postgres target for historical releases of dbt-postgres * update third party image to pip install conditionally
- Loading branch information
1 parent
607646b
commit ee74a60
Showing
2 changed files
with
41 additions
and
165 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 |
---|---|---|
@@ -1,133 +1,60 @@ | ||
## | ||
# Generic dockerfile for dbt image building. | ||
# See README for operational details | ||
## | ||
|
||
# Top level build args | ||
ARG build_for=linux/amd64 | ||
|
||
## | ||
# base image (abstract) | ||
## | ||
# Please do not upgrade beyond python3.10.7 currently as dbt-spark does not support | ||
# 3.11py and images do not get made properly | ||
FROM --platform=$build_for python:3.10.7-slim-bullseye as base | ||
|
||
# N.B. The refs updated automagically every release via bumpversion | ||
ARG dbt_core_ref=dbt-core@v1.8.0b2 | ||
ARG dbt_postgres_ref=dbt-postgres@v1.8.0b2 | ||
ARG dbt_redshift_ref=dbt-redshift@v1.8.0b2 | ||
ARG dbt_bigquery_ref=dbt-bigquery@v1.8.0b2 | ||
ARG dbt_snowflake_ref=dbt-snowflake@v1.8.0b2 | ||
ARG dbt_spark_ref=dbt-spark@v1.8.0b2 | ||
# special case args | ||
ARG dbt_spark_version=all | ||
ARG dbt_third_party | ||
# this image gets published to GHCR for production use | ||
ARG py_version=3.10.7 | ||
|
||
FROM python:$py_version-slim-bullseye as base | ||
|
||
# System setup | ||
RUN apt-get update \ | ||
&& apt-get dist-upgrade -y \ | ||
&& apt-get install -y --no-install-recommends \ | ||
git \ | ||
ssh-client \ | ||
software-properties-common \ | ||
make \ | ||
build-essential \ | ||
ca-certificates \ | ||
libpq-dev \ | ||
build-essential=12.9 \ | ||
ca-certificates=20210119 \ | ||
git=1:2.30.2-1+deb11u2 \ | ||
libpq-dev=13.14-0+deb11u1 \ | ||
make=4.3-4.1 \ | ||
openssh-client=1:8.4p1-5+deb11u3 \ | ||
software-properties-common=0.96.20.2-2.1 \ | ||
&& apt-get clean \ | ||
&& rm -rf \ | ||
/var/lib/apt/lists/* \ | ||
/tmp/* \ | ||
/var/tmp/* | ||
|
||
# Env vars | ||
ENV PYTHONIOENCODING=utf-8 | ||
ENV LANG=C.UTF-8 | ||
|
||
# Update python | ||
RUN python -m pip install --upgrade pip setuptools wheel --no-cache-dir | ||
RUN python -m pip install --upgrade "pip==24.0" "setuptools==69.2.0" "wheel==0.43.0" --no-cache-dir | ||
|
||
# Set docker basics | ||
WORKDIR /usr/app/dbt/ | ||
ENTRYPOINT ["dbt"] | ||
|
||
## | ||
# dbt-core | ||
## | ||
FROM base as dbt-core | ||
RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_core_ref}#egg=dbt-core&subdirectory=core" | ||
|
||
## | ||
# dbt-postgres | ||
## | ||
FROM base as dbt-postgres | ||
RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres&subdirectory=plugins/postgres" | ||
ARG commit_ref=main | ||
|
||
HEALTHCHECK CMD dbt --version || exit 1 | ||
|
||
## | ||
# dbt-redshift | ||
## | ||
FROM base as dbt-redshift | ||
RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_redshift_ref}#egg=dbt-redshift" | ||
WORKDIR /usr/app/dbt/ | ||
ENTRYPOINT ["dbt"] | ||
|
||
RUN python -m pip install --no-cache-dir "dbt-core @ git+https://github.com/dbt-labs/dbt-core@${commit_ref}#subdirectory=core" | ||
|
||
## | ||
# dbt-bigquery | ||
## | ||
FROM base as dbt-bigquery | ||
RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_bigquery_ref}#egg=dbt-bigquery" | ||
|
||
FROM base as dbt-postgres | ||
|
||
## | ||
# dbt-snowflake | ||
## | ||
FROM base as dbt-snowflake | ||
RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_snowflake_ref}#egg=dbt-snowflake" | ||
ARG commit_ref=main | ||
|
||
## | ||
# dbt-spark | ||
## | ||
FROM base as dbt-spark | ||
RUN apt-get update \ | ||
&& apt-get dist-upgrade -y \ | ||
&& apt-get install -y --no-install-recommends \ | ||
python-dev \ | ||
libsasl2-dev \ | ||
gcc \ | ||
unixodbc-dev \ | ||
&& apt-get clean \ | ||
&& rm -rf \ | ||
/var/lib/apt/lists/* \ | ||
/tmp/* \ | ||
/var/tmp/* | ||
RUN python -m pip install --no-cache-dir "git+https://github.com/dbt-labs/${dbt_spark_ref}#egg=dbt-spark[${dbt_spark_version}]" | ||
HEALTHCHECK CMD dbt --version || exit 1 | ||
|
||
WORKDIR /usr/app/dbt/ | ||
ENTRYPOINT ["dbt"] | ||
|
||
RUN python -m pip install --no-cache-dir "dbt-postgres @ git+https://github.com/dbt-labs/dbt-core@${commit_ref}#subdirectory=plugins/postgres" | ||
|
||
|
||
## | ||
# dbt-third-party | ||
## | ||
FROM dbt-core as dbt-third-party | ||
RUN python -m pip install --no-cache-dir "${dbt_third_party}" | ||
|
||
## | ||
# dbt-all | ||
## | ||
FROM base as dbt-all | ||
RUN apt-get update \ | ||
&& apt-get dist-upgrade -y \ | ||
&& apt-get install -y --no-install-recommends \ | ||
python-dev \ | ||
libsasl2-dev \ | ||
gcc \ | ||
unixodbc-dev \ | ||
&& apt-get clean \ | ||
&& rm -rf \ | ||
/var/lib/apt/lists/* \ | ||
/tmp/* \ | ||
/var/tmp/* | ||
RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_redshift_ref}#egg=dbt-redshift" | ||
RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_bigquery_ref}#egg=dbt-bigquery" | ||
RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_snowflake_ref}#egg=dbt-snowflake" | ||
RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_spark_ref}#egg=dbt-spark[${dbt_spark_version}]" | ||
RUN python -m pip install --no-cache "git+https://github.com/dbt-labs/${dbt_postgres_ref}#egg=dbt-postgres&subdirectory=plugins/postgres" | ||
ARG dbt_third_party | ||
|
||
RUN if [ "$dbt_third_party" ]; then \ | ||
python -m pip install --no-cache-dir "${dbt_third_party}"; \ | ||
else \ | ||
echo "No third party adapter provided"; \ | ||
fi \ |
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