-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile.multistage.universal
42 lines (39 loc) · 1.47 KB
/
Dockerfile.multistage.universal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM python:3.11-slim AS base
ENV DBT_HOME=/usr/app \
PYTHONIOENCODING=utf-8
FROM base AS snake
RUN apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common \
make \
build-essential \
libpq-dev \
gcc \
g++ \
libsasl2-dev \
unixodbc-dev \
curl && \
pip install --no-cache-dir --upgrade pip setuptools wheel
FROM snake AS wheel
ARG VERSION=''
ARG PLUGINS=''
RUN mkdir -p ${DBT_HOME} && \
cd ${DBT_HOME} && \
> plugins.txt && \
if [ -z "$PLUGINS" ]; then echo dbt-core >> plugins.txt; fi && \
for PLUGIN in $(echo ${PLUGINS} | \
sed -e 's/\s/,/g' -e 's/\(,\)*/\1/g' -e 's/,/ /g'); do \
echo dbt-${PLUGIN} >> plugins.txt; \
done && \
pip wheel --wheel-dir ${DBT_HOME}/wheels \
--find-links ${DBT_HOME}/wheels \
--requirement plugins.txt
FROM base
LABEL maintainer="Slava Kalashnikov <[email protected]>"
COPY --from=wheel ${DBT_HOME} ${DBT_HOME}
RUN cd ${DBT_HOME} && \
pip --no-cache-dir install \
--find-links ${DBT_HOME}/wheels \
--no-index -r plugins.txt
WORKDIR ${DBT_HOME}
CMD ["dbt", "--version"]