Skip to content

Presto Stable - Publish Docker Images #2

Presto Stable - Publish Docker Images

Presto Stable - Publish Docker Images #2

name: Presto Stable - Publish Docker Images
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 0.291)'
required: true
publish_as_latest:
description: 'Also publish as latest version'
type: boolean
default: true
required: false
env:
VERSION: ${{ github.event.inputs.version }}
DOCKER_REPO: ${{ github.repository }}
jobs:
maven-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
- name: Maven build
run: mvn clean install -DskipTests
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: presto-artifacts-${{ env.VERSION }}
retention-days: 1
path: |
presto-server/target/presto-server-*.tar.gz
presto-cli/target/presto-cli-*-executable.jar
docker-publish:
needs: [maven-build]
runs-on: ubuntu-latest
environment: release
permissions:
packages: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.VERSION }}
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: presto-artifacts-${{ env.VERSION }}
path: ./
- name: Login to dockerhub
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to gitHub container registry
uses: docker/login-action@v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.PRESTODB_CI_TOKEN }}
- name: Set up qemu
uses: docker/setup-qemu-action@v3
- name: Set up docker buildx
uses: docker/setup-buildx-action@v3.9.0
- name: Create and use builder
run: |
docker buildx create --name container --use
docker buildx inspect --bootstrap
- name: Move artifacts to docker directory
run: |
mv ./presto-server/target/presto-server-*.tar.gz docker/
mv ./presto-cli/target/presto-cli-*-executable.jar docker/
- name: Build docker image and publish
uses: docker/build-push-action@v6
with:
context: docker
platforms: linux/amd64,linux/arm64,linux/ppc64le
file: docker/Dockerfile
push: true
build-args: |
PRESTO_VERSION=${{ env.VERSION }}
JMX_PROMETHEUS_JAVAAGENT_VERSION=0.20.0
tags: |
${{ env.DOCKER_REPO }}:${{ env.VERSION }}
${{ github.event.inputs.publish_as_latest == 'true' && format('{0}:latest', env.DOCKER_REPO) || '' }}
ghcr.io/${{ github.repository }}:${{ env.VERSION }}
${{ github.event.inputs.publish_as_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}