Skip to content

Commit

Permalink
trino: Add in-container script to install UDFs
Browse files Browse the repository at this point in the history
This will make it easier for other tools to start our development
container.
  • Loading branch information
emk committed Feb 26, 2024
1 parent e6e4435 commit 0b10761
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 2 additions & 4 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@ trino-plugin:

# Build our Trino image.
trino-image: trino-plugin
docker build -f Dockerfile.trino -t trino-joinery .
docker build -f docker/trino/Dockerfile -t trino-joinery .

# Run our Trino image.
docker-run-trino: trino-image
docker run --name trino-joinery -p 8080:8080 -d trino-joinery
# Wait for Trino to start.
until curl -s http://localhost:8080/v1/info | grep -q '"starting":false'; do sleep 1; done
docker exec -it trino-joinery trino --file "/etc/trino/trino_compat.sql"
docker exec -it trino-joinery install-udfs

# Stop and delete our Trino container.
docker-rm-trino:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.trino → docker/trino/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ FROM trinodb/trino:latest
# Copy ./java/trino-plugin/target/ to /usr/lib/trino/plugin/joinery.
ADD ./java/trino-plugin/target/ /usr/lib/trino/plugin/joinery
ADD ./sql/trino_compat.sql /etc/trino/

ADD ./docker/trino/install-udfs /usr/local/bin/
6 changes: 6 additions & 0 deletions docker/trino/install-udfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -euo pipefail

until curl -s http://localhost:8080/v1/info | grep -q '"starting":false'; do sleep 1; done
trino --file "/etc/trino/trino_compat.sql"

0 comments on commit 0b10761

Please sign in to comment.