0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Added tinybird-cli to devcontainer (#22662)

no issue

Currently we're using the bespoke tinybird-cli docker container to run
CLI commands. We have a command `yarn tb` to open a shell where the CLI
is accessible, but we can't run `tb` commands locally or leverage the
tinybird VSCode extension without installing the tinybird CLI.

This commit installs the Tinybird CLI in the development docker image,
so we can run `tb` commands in a shell in the main Ghost docker image.
It also introduces a `package.json` script to run an instance of the
Ghost container that just sleeps infinitely, so you can attach your IDE
to the container and run `tb` commands directly from your IDE's
terminal.

Not only is this more convenient than keeping an extra terminal tab open
to be able to run `tb` commands, it also lets us use the other tools in
the devcontainer (e.g. `jq`, `node`, etc) in Tinybird scripts, which we
couldn't do before because the tinybird-cli image is pretty barebones.
This commit is contained in:
Chris Raible 2025-03-27 15:42:24 -07:00 committed by GitHub
parent eea005754d
commit 79fc2b7700
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -26,6 +26,7 @@ RUN curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/publ
apt install -y \
git \
stripe \
python3-pip \
procps && \
rm -rf /var/lib/apt/lists/* && \
apt clean
@ -128,6 +129,12 @@ COPY . .
## Build typescript packages
RUN yarn nx run-many -t build:ts
# Install the tinybird CLI
WORKDIR /home/ghost/ghost/web-analytics
RUN pip install -r requirements.txt
WORKDIR $WORKDIR
# Expose the ports
EXPOSE 2368
EXPOSE 4200

View file

@ -38,6 +38,8 @@
"docker:dev": "COMPOSE_PROFILES=${COMPOSE_PROFILES:-ghost} docker compose up --attach=ghost --force-recreate --no-log-prefix",
"docker:build": "COMPOSE_PROFILES=${COMPOSE_PROFILES:-ghost} docker compose build",
"docker:shell": "COMPOSE_PROFILES=${COMPOSE_PROFILES:-ghost} docker compose run --rm -it ghost /bin/bash",
"docker:sleep": "COMPOSE_PROFILES=${COMPOSE_PROFILES:-ghost} docker compose run -d --name ghost-devcontainer --rm -it ghost /bin/bash -c 'sleep infinity'",
"docker:sleep:stop": "docker stop ghost-devcontainer",
"docker:test:unit": "COMPOSE_PROFILES=${COMPOSE_PROFILES:-ghost} docker compose run --rm --no-deps ghost yarn test:unit",
"docker:test:browser": "COMPOSE_PROFILES=${COMPOSE_PROFILES:-ghost} docker compose run --rm ghost yarn test:browser",
"docker:test:all": "COMPOSE_PROFILES=${COMPOSE_PROFILES:-ghost} docker compose run --rm ghost yarn nx run ghost:test:all",