-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create local Dockerfile and bash script for dbt development (#1711)
* start on local dev dockerfile * handle local profiles dir * make dbt docker work with local google credentials * add build-essentials per recommendation * update poetry install method and add libgdal-dev * poetry changed its bin location
- Loading branch information
Showing
3 changed files
with
32 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM python:3.9-buster | ||
|
||
LABEL org.opencontainers.image.source https://github.com/cal-itp/data-infra | ||
|
||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - | ||
RUN apt-get update \ | ||
&& apt-get install -y nodejs build-essential libgdal-dev | ||
|
||
RUN npm install -g --unsafe-perm=true --allow-root netlify-cli | ||
|
||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - | ||
ENV PATH="/root/.local/bin:${PATH}" | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
|
||
COPY ./pyproject.toml /app/pyproject.toml | ||
COPY ./poetry.lock /app/poetry.lock | ||
RUN poetry export -f requirements.txt --without-hashes --output requirements.txt \ | ||
&& pip install -r requirements.txt | ||
|
||
COPY ./dbt_project.yml /app/dbt_project.yml | ||
COPY ./packages.yml /app/packages.yml | ||
RUN dbt deps | ||
|
||
CMD ["dbt", "run", "--project-dir", "/app", "--profiles-dir", "/app"] |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
docker build -t local-dbt -f Dockerfile.local . | ||
docker run --entrypoint dbt -e GOOGLE_APPLICATION_CREDENTIALS=/gcloud_config/application_default_credentials.json -v ~/.dbt:/local_dbt -v ~/.config/gcloud:/gcloud_config -v $(pwd):/app local-dbt "$@" --profiles-dir /local_dbt |