9.3.0 #50
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: splunk_image | |
on: | |
push: | |
branches: | |
- develop | |
paths: | |
- Makefile | |
- splunk/common-files/** | |
workflow_dispatch: # Allows the workflow to be manually triggered | |
jobs: | |
build_splunk_image: | |
name: Build Splunk Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
- name: Check out splunk-ansible | |
uses: actions/checkout@v2 | |
with: | |
repository: splunk/splunk-ansible | |
path: splunk-ansible | |
- name: Set environment variables | |
run: | | |
echo $(grep "SPLUNK_VERSION " Makefile | cut -d " " -f3) > tag_splunk_version | |
echo $(grep "SPLUNK_BUILD " Makefile | cut -d " " -f3) > tag_splunk_build | |
echo $(grep "SPLUNK_PRODUCT " Makefile | cut -d " " -f3) > tag_splunk_product | |
echo $(grep "IMAGE_VERSION ?" Makefile | cut -d " " -f3 | cut -d "\"" -f2) > tag_image_version | |
echo $(grep "SPLUNK_LINUX_BUILD_URL ?=" Makefile | cut -d " " -f3| cut -d "$" -f1) > tag_splunk_url_domain | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build splunk image uid 1000 | |
run: | | |
docker build --file splunk/common-files/Dockerfile \ | |
--platform=linux/amd64 \ | |
--build-arg SPLUNK_BASE_IMAGE=${{ secrets.DOCKER_HUB_USERNAME }}/redhat-8 \ | |
--build-arg UID=1000 \ | |
--build-arg GID=1000 \ | |
--build-arg SPLUNK_BUILD_URL=$(cat tag_splunk_url_domain)$(cat tag_splunk_product)/releases/$(cat tag_splunk_version)/linux/$(cat tag_splunk_product)-$(cat tag_splunk_version)-$(cat tag_splunk_build)-Linux-x86_64.tgz \ | |
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/$(cat tag_splunk_product):$(cat tag_image_version) \ | |
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/$(cat tag_splunk_product):$(cat tag_splunk_version) . | |
- name: Build splunk image uid 501 | |
run: | | |
docker build --file splunk/common-files/Dockerfile \ | |
--platform=linux/amd64 \ | |
--build-arg SPLUNK_BASE_IMAGE=${{ secrets.DOCKER_HUB_USERNAME }}/redhat-8 \ | |
--build-arg UID=501 \ | |
--build-arg GID=20 \ | |
--build-arg SPLUNK_BUILD_URL=$(cat tag_splunk_url_domain)$(cat tag_splunk_product)/releases/$(cat tag_splunk_version)/linux/$(cat tag_splunk_product)-$(cat tag_splunk_version)-$(cat tag_splunk_build)-Linux-x86_64.tgz \ | |
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/$(cat tag_splunk_product)501:$(cat tag_image_version) \ | |
--tag ${{ secrets.DOCKER_HUB_USERNAME }}/$(cat tag_splunk_product)501:$(cat tag_splunk_version) . | |
- name: Push splunk image uid 1000 | |
run: docker push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/$(cat tag_splunk_product) | |
- name: Push splunk image uid 501 | |
run: docker push --all-tags ${{ secrets.DOCKER_HUB_USERNAME }}/$(cat tag_splunk_product)501 |