dockerhub #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: dockerhub | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
tags: | |
description: 'Dockerhub tags' | |
required: false | |
default: '' | |
jobs: | |
push_to_registry: | |
strategy: | |
fail-fast: true | |
matrix: | |
postgres: [16, 15] | |
compiler: [clang] | |
distr: [alpine, ubuntu] | |
include: | |
- distr-version: 3.18 | |
distr: alpine | |
- distr-version: focal | |
distr: ubuntu | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set DOCKER_PG_LLVM_DEPS | |
run: | | |
if [[ "${{ matrix.distr }}" == "alpine" ]] && ([[ "${{ matrix.distr-version }}" == "3.18" ]] || [[ "${{ matrix.distr-version }}" == "edge" ]]); \ | |
then echo "DOCKER_PG_LLVM_DEPS=llvm15-dev clang15" >> $GITHUB_ENV; \ | |
else echo "DOCKER_PG_LLVM_DEPS=llvm-dev clang" >> $GITHUB_ENV; \ | |
fi | |
- name: Echo DOCKER_PG_LLVM_DEP | |
run: echo "DOCKER_PG_LLVM_DEP = ${{ env.DOCKER_PG_LLVM_DEPS }} " | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: orioledb/orioledb | |
tags: ${{ github.event.inputs.tags }} | |
flavor: | | |
latest=auto | |
prefix= | |
suffix=${{ contains(github.ref, 's3') && '-s3' || '' }}-pg${{ matrix.postgres }}${{ matrix.distr == 'ubuntu' && '-ubuntu' || '' }},onlatest=true | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ${{ matrix.distr == 'ubuntu' && 'Dockerfile.ubuntu' || 'Dockerfile' }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
ALPINE_VERSION=${{ matrix.distr == 'alpine' && matrix.distr-version || '' }} | |
UBUNTU_VERSION=${{ matrix.distr == 'ubuntu' && matrix.distr-version || '' }} | |
PG_MAJOR=${{ matrix.postgres }} | |
BUILD_CC_COMPILER=${{ matrix.compiler }} | |
DOCKER_PG_LLVM_DEPS=${{ env.DOCKER_PG_LLVM_DEPS }} |