The Issue:
Trying to set up my devcontainer to use the dbt extension and I’m having a hard to figuring out how
I’m using devcontainers with prefect, dlt, etc
CONTEXT:
"vscode": {
"settings": {
"dbt.executablePath": "/usr/local/bin/dbt",
"dbt.pythonPath": "/usr/local/bin/python",
"dbt.profilesDir": "${containerWorkspaceFolder}/dbt",
"dbt.projectDir": "${containerWorkspaceFolder}",
"dbt.enableTelemetry": false,
"python.linting.enabled": true,
"terminal.integrated.defaultProfile.linux": "bash",
"python.envFile": "${containerWorkspaceFolder}/.env",
"docker.environment": {
"PREFECT_API_URL": "https://api.prefect.cloud/api"
}
},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"dbtlabsinc.dbt",
"ms-azuretools.vscode-docker" // Docker extension
]
}
vscode ➜ /workspaces/CamOnPrefect (main) $ which dbt
/usr/local/bin/dbt
vscode ➜ /workspaces/CamOnPrefect (main) $ dbt --version
Core:
- installed: 1.9.5
- latest: 1.9.5 - Up to date!
Plugins:
- duckdb: 1.9.3 - Up to date!
vscode ➜ /workspaces/CamOnPrefect (main) $
What I’ve already tried
I’ve tried mount in the devcontainer and I’ve tried using curl to install it:
I’ve tried post commands:
bash /home/vscode/.vscode-server/data/User/globalStorage/dbtlabsinc.dbt/install.sh
and
# Install dbt Fusion CLI (latest version using jq)
RUN DBT_URL=$(curl -s https://public.cdn.getdbt.com/fs/cli/latest.json | jq -r '.url') && \
curl -L "$DBT_URL" -o dbt-fusion.tar.gz && \
mkdir -p /tmp/dbt && \
tar -xzf dbt-fusion.tar.gz -C /tmp/dbt && \
mv /tmp/dbt/dbt /home/vscode/.local/bin/dbt && \
chmod +x /home/vscode/.local/bin/dbt && \
rm -rf dbt-fusion.tar.gz /tmp/dbt
but it’s not valid JSON
Some example code or error messages
I’m at a loss for how to handle it?
I’m sure it’s a very simply fix, some line i can add into either my dockerfile or devcontainer which will resolve it all but I’m not even sure where to start?