Skip to content

Commit 062b31f

Browse files
committed
Add Docker Hub build GitHub Action
- Create GitHub Action workflow for building and pushing to Docker Hub - Update README with usage instructions - Workflow accepts Elasticsearch version as input parameter
1 parent 19f2fc0 commit 062b31f

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

.github/workflows/docker-build.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
elasticsearch_version:
7+
description: 'Elasticsearch version'
8+
required: true
9+
default: '8.18.1'
10+
type: string
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v2
21+
22+
- name: Login to DockerHub
23+
uses: docker/login-action@v2
24+
with:
25+
username: ${{ secrets.DOCKERHUB_USERNAME }}
26+
password: ${{ secrets.DOCKERHUB_TOKEN }}
27+
28+
- name: Update Dockerfile with input version
29+
run: |
30+
sed -i "s|FROM elasticsearch:.*|FROM elasticsearch:${{ github.event.inputs.elasticsearch_version }}|" Dockerfile
31+
32+
- name: Build and push
33+
uses: docker/build-push-action@v4
34+
with:
35+
context: .
36+
push: true
37+
tags: |
38+
antistatique/elasticsearch:latest
39+
antistatique/elasticsearch:${{ github.event.inputs.elasticsearch_version }}

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM elasticsearch:8.18.1
2+
3+
RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu && \
4+
/usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-phonetic
5+

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,29 @@
11
# docker-elasticsearch
2+
3+
Custom Elasticsearch Docker image with ICU and Phonetic analysis plugins pre-installed.
4+
5+
## Usage
6+
7+
```
8+
docker pull antistatique/elasticsearch:latest
9+
```
10+
11+
## GitHub Workflow
12+
13+
This repository includes a GitHub Action workflow that can be manually triggered to:
14+
1. Build the Docker image with a specified Elasticsearch version
15+
2. Push the image to Docker Hub as `antistatique/elasticsearch:[version]` and `antistatique/elasticsearch:latest`
16+
17+
### Required Secrets
18+
19+
The following secrets need to be configured in your GitHub repository:
20+
- `DOCKERHUB_USERNAME`: Your Docker Hub username
21+
- `DOCKERHUB_TOKEN`: Your Docker Hub access token
22+
23+
### Running the Workflow
24+
25+
1. Go to the "Actions" tab in your GitHub repository
26+
2. Select the "Build and Push Docker Image" workflow
27+
3. Click "Run workflow"
28+
4. Enter the desired Elasticsearch version (defaults to 8.18.1)
29+
5. Click "Run workflow"

0 commit comments

Comments
 (0)