Skip to content

Commit

Permalink
Create docker-image build
Browse files Browse the repository at this point in the history
  • Loading branch information
matjaz99 authored Feb 10, 2024
1 parent 729b137 commit e5d6b98
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Alertmonitor Docker Image CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:

build:
runs-on: ubuntu-latest
environment: alertmonitor_environment
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Read current version
run: echo "TAG=$(cat src/main/webapp/WEB-INF/version.txt)" >> $GITHUB_ENV
- name: Print current version
run: echo "Building version $TAG"
- name: Build the Docker image
run: docker build . --file Dockerfile --tag matjaz99/alertmonitor:$TAG
- name: Push the image
run: docker push matjaz99/alertmonitor:$TAG
- name: Retag to latest
run: if [[ $TAG != *"SNAPSHOT"* ]]; then docker tag matjaz99/alertmonitor:$TAG matjaz99/alertmonitor:latest; fi
- name: Push the latest image
run: if [[ $TAG != *"SNAPSHOT"* ]]; then docker push matjaz99/alertmonitor:latest; fi

0 comments on commit e5d6b98

Please sign in to comment.