From aeff66188c009db3ce0ee37d75f93a2697feb936 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Wed, 24 Apr 2024 15:42:29 +0100 Subject: [PATCH 01/25] update entry point --- src/Tre-SQL-Trino/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index ea346a1ae..75ba4cb02 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +!/bin/bash # Check if required environment variables are provided if [[ -z "$TRINO_SERVER_URL" || -z "$SQL_STATEMENT" ]]; then From 9148e20a7014c591194a69be8ed76266b924eeb8 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Wed, 24 Apr 2024 21:37:08 +0100 Subject: [PATCH 02/25] fix: set output location --- src/Tre-SQL-Trino/entrypoint.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index 75ba4cb02..70df51cc8 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -1,14 +1,10 @@ -!/bin/bash +#!/bin/bash # Check if required environment variables are provided -if [[ -z "$TRINO_SERVER_URL" || -z "$SQL_STATEMENT" ]]; then - echo "Please provide TRINO_SERVER_URL and SQL_STATEMENT environment variables." +if [[ -z "$TRINO_SERVER_URL" || -z "$SQL_STATEMENT" || -z "$LOCATION" ]]; then + echo "Please provide TRINO_SERVER_URL, SQL_STATEMENT and LOCATION environment variables." exit 1 fi - # Execute Trino CLI command to run SQL statement and output CSV -trino --server "$TRINO_SERVER_URL" --execute "$SQL_STATEMENT" --output-format CSV > ~/result.csv - -ls -la ~/ - +trino --server "$TRINO_SERVER_URL" --execute "$SQL_STATEMENT" --output-format CSV > $LOCATION \ No newline at end of file From 65cc14088a799bd8a687b01b729af66f46df1dd8 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Wed, 24 Apr 2024 21:56:05 +0100 Subject: [PATCH 03/25] fix: permission for /data --- src/Tre-SQL-Trino/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 01a63efb8..a300da4d1 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -31,6 +31,10 @@ COPY entrypoint.sh /home/trino/entrypoint.sh # Make entrypoint script executable RUN chmod +x /home/trino/entrypoint.sh +# Make target for output data +RUN mkdir -p /data +RUN chmod 777 /data + USER trino:trino # Set entrypoint From 0edd74b5d49426d106f193e1e8c8dc252e360926 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Wed, 24 Apr 2024 21:57:57 +0100 Subject: [PATCH 04/25] fix: /data permission --- src/Tre-SQL-Trino/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index 70df51cc8..798f741f5 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -6,5 +6,6 @@ if [[ -z "$TRINO_SERVER_URL" || -z "$SQL_STATEMENT" || -z "$LOCATION" ]]; then exit 1 fi + # Execute Trino CLI command to run SQL statement and output CSV trino --server "$TRINO_SERVER_URL" --execute "$SQL_STATEMENT" --output-format CSV > $LOCATION \ No newline at end of file From 499c8454762c9a63163e9215843bf1c1d362c477 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Wed, 24 Apr 2024 22:12:59 +0100 Subject: [PATCH 05/25] fix: change opener of /data --- src/Tre-SQL-Trino/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index a300da4d1..f01bd6720 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -34,6 +34,7 @@ RUN chmod +x /home/trino/entrypoint.sh # Make target for output data RUN mkdir -p /data RUN chmod 777 /data +RUN chown -R trino:trino /data USER trino:trino From 984fd3e9f39e1521c6ca9865e3a5f0cb3e4b883f Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Wed, 24 Apr 2024 23:16:14 +0100 Subject: [PATCH 06/25] fix: extra logging --- src/Tre-SQL-Trino/entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index 798f741f5..5f84a1615 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -6,6 +6,10 @@ if [[ -z "$TRINO_SERVER_URL" || -z "$SQL_STATEMENT" || -z "$LOCATION" ]]; then exit 1 fi +whoami + +pwd + # Execute Trino CLI command to run SQL statement and output CSV trino --server "$TRINO_SERVER_URL" --execute "$SQL_STATEMENT" --output-format CSV > $LOCATION \ No newline at end of file From e9219a2cac85b1a2fa968cc9ad1aabb0b18b30e4 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Wed, 24 Apr 2024 23:33:53 +0100 Subject: [PATCH 07/25] fix: change entrypoint user --- src/Tre-SQL-Trino/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index f01bd6720..2138830e6 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -35,6 +35,7 @@ RUN chmod +x /home/trino/entrypoint.sh RUN mkdir -p /data RUN chmod 777 /data RUN chown -R trino:trino /data +RUN chown trino:trino /home/trino/entrypoint.sh USER trino:trino From c718dc96802e5d508354ce61a1da2b3eeaf4a2ab Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Wed, 24 Apr 2024 23:59:12 +0100 Subject: [PATCH 08/25] fix: more logging --- src/Tre-SQL-Trino/entrypoint.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index 5f84a1615..a98587b91 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -12,4 +12,7 @@ pwd # Execute Trino CLI command to run SQL statement and output CSV -trino --server "$TRINO_SERVER_URL" --execute "$SQL_STATEMENT" --output-format CSV > $LOCATION \ No newline at end of file +trino --server "$TRINO_SERVER_URL" --execute "$SQL_STATEMENT" --output-format CSV > $LOCATION + +cd ~/ +pwd From 6447c2456d31ac2c87715e19895858c5adce3ce3 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 00:19:19 +0100 Subject: [PATCH 09/25] fix: move dockerfile order around --- src/Tre-SQL-Trino/Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 2138830e6..6ab9f29cc 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -10,6 +10,12 @@ FROM trinodb/trino:422 # apt-get remove -y wget && \ # apt-get clean +# Make target for output data +RUN mkdir -p /home/trino/data +RUN chmod 777 /home/trino/data +RUN chown -R trino:trino /home/trino/data + + # Set working directory WORKDIR /workspace @@ -31,11 +37,7 @@ COPY entrypoint.sh /home/trino/entrypoint.sh # Make entrypoint script executable RUN chmod +x /home/trino/entrypoint.sh -# Make target for output data -RUN mkdir -p /data -RUN chmod 777 /data -RUN chown -R trino:trino /data -RUN chown trino:trino /home/trino/entrypoint.sh + USER trino:trino From 734491806cdd8087ff084a825a098f55da8b15fc Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 09:33:54 +0100 Subject: [PATCH 10/25] container as root --- src/Tre-SQL-Trino/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 6ab9f29cc..0ad23f804 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -19,7 +19,7 @@ RUN chown -R trino:trino /home/trino/data # Set working directory WORKDIR /workspace -USER root:root +#USER root:root # Copy entrypoint script #COPY entrypoint.sh /usr/local/bin/entrypoint.sh From 22f5eea6090cfca4b3370a2f517046a7cad5a545 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 09:34:41 +0100 Subject: [PATCH 11/25] fix: also list contents --- src/Tre-SQL-Trino/entrypoint.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index a98587b91..1292869f5 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -16,3 +16,4 @@ trino --server "$TRINO_SERVER_URL" --execute "$SQL_STATEMENT" --output-format CS cd ~/ pwd +ls -la ~/ From 40be56a7f3032cd5b5c65444d8b34bd3cb46e643 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 10:17:27 +0100 Subject: [PATCH 12/25] dockerfile back to normal --- src/Tre-SQL-Trino/Dockerfile | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 0ad23f804..cfbf4d4ce 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -10,11 +10,6 @@ FROM trinodb/trino:422 # apt-get remove -y wget && \ # apt-get clean -# Make target for output data -RUN mkdir -p /home/trino/data -RUN chmod 777 /home/trino/data -RUN chown -R trino:trino /home/trino/data - # Set working directory WORKDIR /workspace @@ -37,8 +32,6 @@ COPY entrypoint.sh /home/trino/entrypoint.sh # Make entrypoint script executable RUN chmod +x /home/trino/entrypoint.sh - - USER trino:trino # Set entrypoint From d48dbb606062fa7603083a25b57782f13e455c1e Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 10:20:04 +0100 Subject: [PATCH 13/25] haps now back to workign build ? --- src/Tre-SQL-Trino/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index cfbf4d4ce..c2667f705 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -14,7 +14,7 @@ FROM trinodb/trino:422 # Set working directory WORKDIR /workspace -#USER root:root +USER root:root # Copy entrypoint script #COPY entrypoint.sh /usr/local/bin/entrypoint.sh From 0827faa58c1027765168af37999f9958ec68041c Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 10:25:54 +0100 Subject: [PATCH 14/25] try using workdir --- src/Tre-SQL-Trino/Dockerfile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index c2667f705..57df48c4f 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -25,14 +25,24 @@ USER root:root # Set entrypoint #ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] - # Copy entrypoint script -COPY entrypoint.sh /home/trino/entrypoint.sh +COPY entrypoint.sh /workspace/entrypoint.sh # Make entrypoint script executable -RUN chmod +x /home/trino/entrypoint.sh +RUN chmod +x /workspace/entrypoint.sh USER trino:trino # Set entrypoint -ENTRYPOINT ["/home/trino/entrypoint.sh"] +ENTRYPOINT ["/workspace/entrypoint.sh"] + +# Copy entrypoint script +#COPY entrypoint.sh /home/trino/entrypoint.sh + +# Make entrypoint script executable +#RUN chmod +x /home/trino/entrypoint.sh + +#USER trino:trino + +# Set entrypoint +#ENTRYPOINT ["/home/trino/entrypoint.sh"] From 7151a1728ffd0f4a7142974171bc9c6f3347bbca Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 10:43:59 +0100 Subject: [PATCH 15/25] new docker file --- src/Tre-SQL-Trino/Dockerfile | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 57df48c4f..24849057d 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -16,6 +16,10 @@ WORKDIR /workspace USER root:root +RUN mkdir /home/trino/data +RUN chmod 777 /home/trino/data +RUN chown trino:trino /home/trino/data + # Copy entrypoint script #COPY entrypoint.sh /usr/local/bin/entrypoint.sh @@ -26,23 +30,12 @@ USER root:root #ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] # Copy entrypoint script -COPY entrypoint.sh /workspace/entrypoint.sh +COPY entrypoint.sh /home/trino/entrypoint.sh # Make entrypoint script executable -RUN chmod +x /workspace/entrypoint.sh +RUN chmod +x /home/trino/entrypoint.sh USER trino:trino # Set entrypoint -ENTRYPOINT ["/workspace/entrypoint.sh"] - -# Copy entrypoint script -#COPY entrypoint.sh /home/trino/entrypoint.sh - -# Make entrypoint script executable -#RUN chmod +x /home/trino/entrypoint.sh - -#USER trino:trino - -# Set entrypoint -#ENTRYPOINT ["/home/trino/entrypoint.sh"] +ENTRYPOINT ["/home/trino/entrypoint.sh"] From eb31645b7376df037cb28d9e22ab2846e9876a6e Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 10:52:41 +0100 Subject: [PATCH 16/25] dockerfile with sleep in --- src/Tre-SQL-Trino/entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index 1292869f5..3754ad13b 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -1,5 +1,7 @@ #!/bin/bash +sleep 30000 + # Check if required environment variables are provided if [[ -z "$TRINO_SERVER_URL" || -z "$SQL_STATEMENT" || -z "$LOCATION" ]]; then echo "Please provide TRINO_SERVER_URL, SQL_STATEMENT and LOCATION environment variables." From 587b463be232e2695f30aa21a33d89beb6e12589 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 11:02:49 +0100 Subject: [PATCH 17/25] move data directory --- src/Tre-SQL-Trino/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 24849057d..9d9461aad 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -16,9 +16,6 @@ WORKDIR /workspace USER root:root -RUN mkdir /home/trino/data -RUN chmod 777 /home/trino/data -RUN chown trino:trino /home/trino/data # Copy entrypoint script #COPY entrypoint.sh /usr/local/bin/entrypoint.sh @@ -37,5 +34,7 @@ RUN chmod +x /home/trino/entrypoint.sh USER trino:trino +RUN mkdir /home/trino/data + # Set entrypoint ENTRYPOINT ["/home/trino/entrypoint.sh"] From f3c840a3c4508d857bc035ed5381f5b0140a7c89 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 13:58:22 +0100 Subject: [PATCH 18/25] tidy up the docker image --- src/Tre-SQL-Trino/Dockerfile | 11 +---------- src/Tre-SQL-Trino/entrypoint.sh | 21 +++++++++------------ 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 9d9461aad..3f0ca6265 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -16,16 +16,6 @@ WORKDIR /workspace USER root:root - -# Copy entrypoint script -#COPY entrypoint.sh /usr/local/bin/entrypoint.sh - -# Make entrypoint script executable -#RUN chmod +x /usr/local/bin/entrypoint.sh - -# Set entrypoint -#ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] - # Copy entrypoint script COPY entrypoint.sh /home/trino/entrypoint.sh @@ -35,6 +25,7 @@ RUN chmod +x /home/trino/entrypoint.sh USER trino:trino RUN mkdir /home/trino/data +RUN mkdir /data # Set entrypoint ENTRYPOINT ["/home/trino/entrypoint.sh"] diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index 3754ad13b..0e77e616b 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -1,21 +1,18 @@ #!/bin/bash -sleep 30000 +if [ -z "$TRINO_SERVER_URL" ]; then + export TRINO_SERVER_URL="http://192.168.70.92:8090" +fi + +if [ -z "$LOCATION" ]; then + export LOCATION="/data" +fi # Check if required environment variables are provided -if [[ -z "$TRINO_SERVER_URL" || -z "$SQL_STATEMENT" || -z "$LOCATION" ]]; then - echo "Please provide TRINO_SERVER_URL, SQL_STATEMENT and LOCATION environment variables." +if [[ -z "$SQL_STATEMENT" ]]; then + echo "SQL_STATEMENT environment variables." exit 1 fi -whoami - -pwd - - # Execute Trino CLI command to run SQL statement and output CSV trino --server "$TRINO_SERVER_URL" --execute "$SQL_STATEMENT" --output-format CSV > $LOCATION - -cd ~/ -pwd -ls -la ~/ From 18732b493117e93b47a459d64d0b4ff46cccc3d1 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 13:59:59 +0100 Subject: [PATCH 19/25] Move to workspace from home directory --- src/Tre-SQL-Trino/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 3f0ca6265..fe025e61f 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -17,15 +17,15 @@ WORKDIR /workspace USER root:root # Copy entrypoint script -COPY entrypoint.sh /home/trino/entrypoint.sh +COPY entrypoint.sh /workspace/entrypoint.sh # Make entrypoint script executable -RUN chmod +x /home/trino/entrypoint.sh +RUN chmod +x /workspace/entrypoint.sh USER trino:trino -RUN mkdir /home/trino/data +RUN mkdir /workspace/data RUN mkdir /data # Set entrypoint -ENTRYPOINT ["/home/trino/entrypoint.sh"] +ENTRYPOINT ["/workspace/entrypoint.sh"] From bd44f968c5bcbc137cd3294f72796d62312f5018 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 14:02:04 +0100 Subject: [PATCH 20/25] move stuff around --- src/Tre-SQL-Trino/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index fe025e61f..498ed2a3d 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -13,6 +13,9 @@ FROM trinodb/trino:422 # Set working directory WORKDIR /workspace +RUN mkdir /data +RUN chown trino:trino /data +RUN chown trino/trino /workspace USER root:root @@ -25,7 +28,6 @@ RUN chmod +x /workspace/entrypoint.sh USER trino:trino RUN mkdir /workspace/data -RUN mkdir /data # Set entrypoint ENTRYPOINT ["/workspace/entrypoint.sh"] From 006e584c89d46b4ff1a57bfa40ef64df15b5f3c0 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 14:08:39 +0100 Subject: [PATCH 21/25] correction to dockerfile --- src/Tre-SQL-Trino/Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index 498ed2a3d..ab0df3e04 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -13,12 +13,13 @@ FROM trinodb/trino:422 # Set working directory WORKDIR /workspace -RUN mkdir /data -RUN chown trino:trino /data -RUN chown trino/trino /workspace USER root:root +RUN mkdir -p /data +RUN chown trino:trino /data +RUN chown trino/trino /workspace + # Copy entrypoint script COPY entrypoint.sh /workspace/entrypoint.sh @@ -27,7 +28,7 @@ RUN chmod +x /workspace/entrypoint.sh USER trino:trino -RUN mkdir /workspace/data +RUN mkdir -p /workspace/data # Set entrypoint ENTRYPOINT ["/workspace/entrypoint.sh"] From fa55c47aa69bad0d49eeba8143e761414c6abc44 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 14:12:39 +0100 Subject: [PATCH 22/25] correct dockerfile --- src/Tre-SQL-Trino/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index ab0df3e04..ee6ca3dba 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -16,9 +16,8 @@ WORKDIR /workspace USER root:root -RUN mkdir -p /data -RUN chown trino:trino /data -RUN chown trino/trino /workspace +RUN mkdir -p /data && chown trino:trino /data +RUN chown trino:trino /workspace # Copy entrypoint script COPY entrypoint.sh /workspace/entrypoint.sh From 167b972659377657b5dc20dd06ca56a5dd1901b6 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 14:13:35 +0100 Subject: [PATCH 23/25] better name for command --- src/Tre-SQL-Trino/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Tre-SQL-Trino/Dockerfile b/src/Tre-SQL-Trino/Dockerfile index ee6ca3dba..dc68aab17 100644 --- a/src/Tre-SQL-Trino/Dockerfile +++ b/src/Tre-SQL-Trino/Dockerfile @@ -21,9 +21,11 @@ RUN chown trino:trino /workspace # Copy entrypoint script COPY entrypoint.sh /workspace/entrypoint.sh +COPY entrypoint.sh /workspace/runsql.sh # Make entrypoint script executable RUN chmod +x /workspace/entrypoint.sh +RUN chmod +x /workspace/runsql.sh USER trino:trino From 55ebb2c099bd6b22a2bbadbe35a84fd4565f5dde Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 14:25:08 +0100 Subject: [PATCH 24/25] empty string test failing --- src/Tre-SQL-Trino/entrypoint.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index 0e77e616b..6eecd324c 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -1,11 +1,11 @@ #!/bin/bash -if [ -z "$TRINO_SERVER_URL" ]; then +if [[ -z "$TRINO_SERVER_URL" ]]; then export TRINO_SERVER_URL="http://192.168.70.92:8090" fi -if [ -z "$LOCATION" ]; then - export LOCATION="/data" +if [[ -z "$LOCATION" ]]; then + export LOCATION="/data/result.csv" fi # Check if required environment variables are provided From 5fd14df3f17d1c0d1d6ffbb3bf24d9e712c3b422 Mon Sep 17 00:00:00 2001 From: Simon Thompson Date: Thu, 25 Apr 2024 17:33:41 +0100 Subject: [PATCH 25/25] change defaults --- src/Tre-SQL-Trino/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tre-SQL-Trino/entrypoint.sh b/src/Tre-SQL-Trino/entrypoint.sh index 6eecd324c..ad0cc0b04 100644 --- a/src/Tre-SQL-Trino/entrypoint.sh +++ b/src/Tre-SQL-Trino/entrypoint.sh @@ -5,7 +5,7 @@ if [[ -z "$TRINO_SERVER_URL" ]]; then fi if [[ -z "$LOCATION" ]]; then - export LOCATION="/data/result.csv" + export LOCATION="/workspace/data/result.csv" fi # Check if required environment variables are provided