-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
62 lines (51 loc) · 1.42 KB
/
Dockerfile
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# SPDX-FileCopyrightText: 2022 Impulso Gov <[email protected]>
#
# SPDX-License-Identifier: MIT
FROM python:3.8.8-slim-buster as base
# Atualizar sistema
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 \
curl \
python-pip \
&& apt-get clean \
&& rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/*
# Variáveis de ambiente
ENV PYTHONIOENCODING=utf-8
ENV LANG=C.UTF-8
# Atualizar Python
RUN python -m pip install --upgrade setuptools wheel --no-cache-dir
# Criar diretório de trabalho
WORKDIR /usr/app/dbt/
VOLUME /usr/app/dbt/target
VOLUME /usr/app/dbt/logs
# Instalar poetry
FROM base as poetry
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="/root/.local/bin:$PATH"
# Instalar dependências
FROM poetry as dependencias-python
COPY ./pyproject.toml ./pyproject.toml
COPY ./poetry.lock ./poetry.lock
RUN poetry install --no-root --no-dev
# Instalar pacotes dbt
FROM dependencias-python as dependencias-dbt
ENV DBT_PROFILES_DIR="/usr/app/dbt/"
COPY ./dbt_project.yml ./dbt_project.yml
COPY ./packages.yml ./packages.yml
RUN poetry run dbt deps
# Copiar definições de modelos, macros, seeds etc.
FROM dependencias-dbt as final
COPY . .
# Usar `poetry run` em todos os comandos.
ENTRYPOINT ["poetry", "run"]