Skip to content

Commit ae347a1

Browse files
author
CNE Bot
committed
Initial commit: Template content from https://github.com/tikalk/cne-dagster-template
0 parents  commit ae347a1

14 files changed

Lines changed: 2703 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: DBT Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main #
7+
pull_request:
8+
types: [closed, opened, synchronize] # 👈 Add this trigger for PR closures
9+
10+
11+
jobs:
12+
run-dbt:
13+
name: Build Docker Image
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.head_ref }}
21+
submodules: true
22+
23+
24+
- name: Log in to GitHub Container Registry
25+
uses: docker/login-action@v2
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Write BIGQUERY_KEYFILE_JSON to File
32+
env:
33+
BIGQUERY_KEYFILE_JSON_BASE64: ${{ secrets.BIGQUERY_KEYFILE_JSON_BASE64 }}
34+
run: |
35+
mkdir -p ./cne-dbt-template/.keys
36+
echo "$BIGQUERY_KEYFILE_JSON_BASE64" | base64 --decode > ./cne-dbt-template/.keys/staging.json
37+
echo "BIGQUERY_KEYFILE_PATH=./cne-dbt-template/.keys/staging.json" >> $GITHUB_ENV
38+
39+
- name: Build Docker image
40+
run: |
41+
ls -la
42+
ls -la cne-dbt-template
43+
docker build -t ghcr.io/${{ github.repository }}/dagster_dbt:latest .
44+
45+
- name: Push Docker image
46+
run: |
47+
docker push ghcr.io/${{ github.repository }}/dagster_dbt:latest
48+

.gitignore

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# dbt compiled files
2+
/target/
3+
/dbt_packages/
4+
/logs/
5+
/dbt_modules/
6+
7+
edr_target/
8+
9+
.user.yml
10+
.env
11+
.env.bak
12+
13+
# snowflake pkey
14+
*.p8
15+
16+
# macOS
17+
.DS_Store
18+
.AppleDouble
19+
.LSOverride
20+
._*
21+
22+
# VSCode
23+
.vscode/
24+
!.vscode/settings.json
25+
!.vscode/tasks.json
26+
!.vscode/launch.json
27+
!.vscode/extensions.json
28+
!.vscode/PythonSettings.json
29+
!.vscode/python.code-snippets
30+
*.codeworkspace
31+
.history/
32+
33+
# IntelliJ / PyCharm
34+
.idea
35+
.idea/*
36+
.run/*
37+
38+
39+
# Python
40+
__pycache__/
41+
.pytest_cache
42+
*.py[cod]
43+
*$py.class
44+
*.so
45+
.Python
46+
*.egg-info/
47+
*.egg
48+
.installed.cfg
49+
*.swp
50+
MANIFEST
51+
.venv
52+
*.python-version
53+
54+
# Python Testing
55+
htmlcov/
56+
.tox/
57+
.nox/
58+
.coverage
59+
.coverage.*
60+
.cache
61+
nosetests.xml
62+
coverage.xml
63+
*.cover
64+
*.py,cover
65+
.hypothesis/
66+
.pytest_cache/
67+
cover/
68+
69+
70+
71+
### Taskfiles
72+
.task/checksum/*
73+
74+
75+
# Jupyter notebooks
76+
.ipynb_checkpoints
77+
notebooks/playground/*
78+
!notebooks/playground/.gitkeep
79+
80+
logs/
81+
.qodo
82+
83+
#keys
84+
.keys/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "cne-dbt-template"]
2+
path = cne-dbt-template
3+
url = https://github.com/tikalk/cne-dbt-template.git

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM python:3.11.3-slim
2+
3+
ENV DAGSTER_HOME=/opt/dagster/app
4+
5+
6+
RUN apt-get update && \
7+
apt-get install -y --no-install-recommends build-essential curl && \
8+
pip install --no-cache-dir --upgrade pip && \
9+
apt-get clean && \
10+
rm -rf /var/lib/apt/lists/*
11+
12+
RUN pip install dagster dagit dagster-dbt dagster-webserver dbt-bigquery dbt-core
13+
# Add the rest of the app files
14+
ADD . $DAGSTER_HOME/cne_dagster
15+
16+
ENV DBT_PROFILE_PROJECT=tdw-staging \
17+
DBT_PROFILE=tikal_dbt \
18+
BIGQUERY_DATABASE=chaimt_dwh \
19+
DATASET_PREFIX=chaimt_dwh \
20+
TARGET_NAME=dev \
21+
BIGQUERY_KEYFILE_PATH=.keys/staging.json \
22+
SOURCE_DATABASE=dwh-dev-414206 \
23+
BIGQUERY_ACCOUNT=dwh-dev-414206
24+
25+
26+
RUN cd $DAGSTER_HOME/cne_dagster/cne-dbt-template && dbt deps --quiet && dbt parse --quiet
27+
28+
WORKDIR $DAGSTER_HOME/cne_dagster/cne_dagster
29+
30+
31+
# Set environment variable for production
32+
ENV PYTHONUNBUFFERED=1
33+
34+
# Command to run the Dagster app with uvicorn
35+
36+
37+
EXPOSE 3000
38+
39+
CMD ["dagster", "dev", "-h", "0.0.0.0", "-p", "3000"]

0 commit comments

Comments
 (0)