Skip to content

Build and Push Docker Image #2

Build and Push Docker Image

Build and Push Docker Image #2

Workflow file for this run

name: Build and Push Docker Image
on:
workflow_dispatch:
inputs:
elasticsearch_version:
description: 'Elasticsearch version'
required: true
default: '8.18.1'
type: string
tag_as_latest:
description: 'Tag this version as latest'
required: true
default: true
type: boolean
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Update Dockerfile with input version
run: |
sed -i "s|FROM elasticsearch:.*|FROM elasticsearch:${{ github.event.inputs.elasticsearch_version }}|" Dockerfile
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ github.event.inputs.tag_as_latest == 'true' && 'antistatique/elasticsearch:latest' || '' }}
antistatique/elasticsearch:${{ github.event.inputs.elasticsearch_version }}