From d2adc515c33490909b8806a4eb7853e8eb94efa2 Mon Sep 17 00:00:00 2001 From: August Kilponen Date: Wed, 2 Oct 2024 16:53:37 +0300 Subject: [PATCH] DBT:n ajokontin build --- .github/workflows/build-dbt-runner.yml | 20 ++++++++++++++++++++ dbt-container/Dockerfile | 12 ++++++++++++ dbt-container/README.md | 4 ++++ dbt-container/build.sh | 4 ++++ dbt-container/install.sh | 19 +++++++++++++++++++ dbt-container/run.sh | 7 +++++++ 6 files changed, 66 insertions(+) create mode 100644 .github/workflows/build-dbt-runner.yml create mode 100644 dbt-container/Dockerfile create mode 100644 dbt-container/README.md create mode 100755 dbt-container/build.sh create mode 100644 dbt-container/install.sh create mode 100755 dbt-container/run.sh diff --git a/.github/workflows/build-dbt-runner.yml b/.github/workflows/build-dbt-runner.yml new file mode 100644 index 0000000..5e7ffe6 --- /dev/null +++ b/.github/workflows/build-dbt-runner.yml @@ -0,0 +1,20 @@ +name: Build DBT Runner Container + +on: + workflow_dispatch: + push: + paths: + - 'dbt/**' + - 'dbt-container/**' + +jobs: + build-and-deploy-container: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Build container + run: dbt-container/build.sh + + diff --git a/dbt-container/Dockerfile b/dbt-container/Dockerfile new file mode 100644 index 0000000..77d1c15 --- /dev/null +++ b/dbt-container/Dockerfile @@ -0,0 +1,12 @@ +FROM alpine:3.20 +RUN apk upgrade --no-cache +RUN apk --no-cache add bash + +WORKDIR /root/ +COPY ./run.sh ./ +COPY ./install.sh ./ +RUN \ + bash install.sh && \ + rm install.sh + +ENTRYPOINT ["bash", "/root/run.sh"] diff --git a/dbt-container/README.md b/dbt-container/README.md new file mode 100644 index 0000000..34b3d17 --- /dev/null +++ b/dbt-container/README.md @@ -0,0 +1,4 @@ +## Kontin käynnistäminen +``` +docker run --rm --name dbt-runner ovara-dbt-runner +``` diff --git a/dbt-container/build.sh b/dbt-container/build.sh new file mode 100755 index 0000000..b84d2c8 --- /dev/null +++ b/dbt-container/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +cd "${0%/*}" +docker build --progress=plain -t ovara-dbt-runner . +cd - diff --git a/dbt-container/install.sh b/dbt-container/install.sh new file mode 100644 index 0000000..74e0196 --- /dev/null +++ b/dbt-container/install.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -eu + +case "$(uname -m)" in + aarch64) ARCHITECTURE="arm64" ;; + x86_64) ARCHITECTURE="amd64" ;; + *) ARCHITECTURE=$(uname -m) ;; +esac +echo $ARCHITECTURE + +echo "Installing needed software" +apk --no-cache add \ + python3 + +ln -sf /usr/bin/python3 /usr/bin/python + +ls -Al /root +cat /root/run.sh diff --git a/dbt-container/run.sh b/dbt-container/run.sh new file mode 100755 index 0000000..38183f0 --- /dev/null +++ b/dbt-container/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +echo "Running Ovara DBT script..." + +exit 0