Skip to content

Commit 7135d94

Browse files
authored
Merge pull request #3 from fccn/feat/add_trino_and_superset_image
feat: add trino and superset to DockerHub
2 parents 8d7c0f2 + 28a5042 commit 7135d94

File tree

6 files changed

+153
-0
lines changed

6 files changed

+153
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
paths:
8+
- 'superset/**'
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Docker meta
23+
id: meta
24+
uses: docker/metadata-action@v5
25+
with:
26+
images: |
27+
nauedu/nau-analytics-superset
28+
tags: |
29+
type=sha
30+
31+
- name: Build Docker image (no push yet)
32+
uses: docker/build-push-action@v6
33+
with:
34+
context: ./
35+
file: ./spark-shell/Dockerfile
36+
load: true
37+
tags: ${{ steps.meta.outputs.tags }}
38+
labels: ${{ steps.meta.outputs.labels }}
39+
40+
- name: Login to DockerHub
41+
if: ${{ github.event_name != 'pull_request' }}
42+
uses: docker/login-action@v3
43+
with:
44+
username: ${{ secrets.DOCKERHUB_USERNAME }}
45+
password: ${{ secrets.DOCKERHUB_TOKEN }}
46+
47+
- name: Push Docker image (branch-specific)
48+
if: ${{ github.event_name != 'pull_request' }}
49+
run: |
50+
set -eux
51+
IMAGE_NAME="nauedu/nau-analytics-superset"
52+
SHA_TAG=$(echo "${GITHUB_SHA}" | head -c7)
53+
54+
if [ "${GITHUB_REF_NAME}" = "main" ]; then
55+
# Tag and push with 'latest' and SHA
56+
docker tag $IMAGE_NAME:sha-$SHA_TAG $IMAGE_NAME:latest
57+
docker tag $IMAGE_NAME:sha-$SHA_TAG $IMAGE_NAME:$SHA_TAG
58+
59+
docker push $IMAGE_NAME:latest
60+
docker push $IMAGE_NAME:$SHA_TAG
61+
62+
echo "✅ Pushed tags 'latest' and '$SHA_TAG' for main branch to https://hub.docker.com/r/$IMAGE_NAME/tags"
63+
else
64+
# Tag and push with branch name
65+
BRANCH_TAG=$(echo "${GITHUB_REF_NAME}" | tr '/' '-')
66+
docker tag $IMAGE_NAME:sha-$SHA_TAG $IMAGE_NAME:$BRANCH_TAG
67+
docker push $IMAGE_NAME:$BRANCH_TAG
68+
69+
echo "✅ Pushed branch tag '$BRANCH_TAG' to https://hub.docker.com/r/$IMAGE_NAME/tags"
70+
fi
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
paths:
8+
- 'trino/**'
9+
workflow_dispatch:
10+
11+
jobs:
12+
build-and-push:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
22+
- name: Docker meta
23+
id: meta
24+
uses: docker/metadata-action@v5
25+
with:
26+
images: |
27+
nauedu/nau-analytics-trino
28+
tags: |
29+
type=sha
30+
31+
- name: Build Docker image (no push yet)
32+
uses: docker/build-push-action@v6
33+
with:
34+
context: ./
35+
file: ./spark-shell/Dockerfile
36+
load: true
37+
tags: ${{ steps.meta.outputs.tags }}
38+
labels: ${{ steps.meta.outputs.labels }}
39+
40+
- name: Login to DockerHub
41+
if: ${{ github.event_name != 'pull_request' }}
42+
uses: docker/login-action@v3
43+
with:
44+
username: ${{ secrets.DOCKERHUB_USERNAME }}
45+
password: ${{ secrets.DOCKERHUB_TOKEN }}
46+
47+
- name: Push Docker image (branch-specific)
48+
if: ${{ github.event_name != 'pull_request' }}
49+
run: |
50+
set -eux
51+
IMAGE_NAME="nauedu/nau-analytics-trino"
52+
SHA_TAG=$(echo "${GITHUB_SHA}" | head -c7)
53+
54+
if [ "${GITHUB_REF_NAME}" = "main" ]; then
55+
# Tag and push with 'latest' and SHA
56+
docker tag $IMAGE_NAME:sha-$SHA_TAG $IMAGE_NAME:latest
57+
docker tag $IMAGE_NAME:sha-$SHA_TAG $IMAGE_NAME:$SHA_TAG
58+
59+
docker push $IMAGE_NAME:latest
60+
docker push $IMAGE_NAME:$SHA_TAG
61+
62+
echo "✅ Pushed tags 'latest' and '$SHA_TAG' for main branch to https://hub.docker.com/r/$IMAGE_NAME/tags"
63+
else
64+
# Tag and push with branch name
65+
BRANCH_TAG=$(echo "${GITHUB_REF_NAME}" | tr '/' '-')
66+
docker tag $IMAGE_NAME:sha-$SHA_TAG $IMAGE_NAME:$BRANCH_TAG
67+
docker push $IMAGE_NAME:$BRANCH_TAG
68+
69+
echo "✅ Pushed branch tag '$BRANCH_TAG' to https://hub.docker.com/r/$IMAGE_NAME/tags"
70+
fi

superset/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**
2+
!./*

superset/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM apache/superset:4.1.4-py310
2+
3+
# Dialect Trino + driver PyMySQL para o metastore MySQL
4+
RUN pip install --no-cache-dir "trino" "pymysql"

trino/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**
2+
!./*

trino/Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM trinodb/trino:478
2+
3+
# Copia o driver JDBC do MySQL para o plugin do Iceberg
4+
# (assume que o ficheiro .jar está ao lado deste Dockerfile)
5+
ADD mysql-connector-j.jar /usr/lib/trino/plugin/iceberg/

0 commit comments

Comments
 (0)