Improve Tinybird login experience

- This helps clean up the TB setup since we no longer need to install the CLI tools locally
- The service dependency chaining is a bit annoying here but it should all work
- We have to change some of the mounts around because of how TB works
  and where it expects tokens to be
This commit is contained in:
James Loh
2025-06-25 16:06:11 +10:00
parent 57c084aac0
commit 29e86facec
4 changed files with 58 additions and 7 deletions

View File

@@ -9,6 +9,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
WORKDIR /home/tinybird
# Install Tinybird using the standard installation script
COPY handleLogin.sh /usr/local/bin/tinybird-login
COPY tb-wrapper /usr/local/bin/tb-wrapper
RUN curl https://tinybird.co | sh
ENV PATH="/root/.local/bin:$PATH"

11
tinybird/handleLogin.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# Check if already logged in
if [[ -f "/home/tinybird/.tinyb" ]]
then
echo "Tinybird already logged in"
exit 0
fi
# Login to Tinybird
tb login --method code

18
tinybird/tb-wrapper Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Check if .tinyb exists in current directory
if [[ ! -f "./.tinyb" ]]
then
# If not, try to copy from home directory
if [[ -f "/home/tinybird/.tinyb" ]]
then
cp /home/tinybird/.tinyb ./.tinyb
echo "Copied .tinyb auth file to current directory"
else
echo "No .tinyb auth file found, please run 'docker compose run --rm tinybird-login' first to login"
exit 1
fi
fi
# Run the tinybird command
tb "$@"