-
-
Notifications
You must be signed in to change notification settings - Fork 15
38 lines (34 loc) · 1.21 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Build & Push Docker image
on:
workflow_dispatch:
inputs:
imageTag:
description: 'Tag to be used for the Docker image'
required: true
type: string
push:
branches: [ "main", Main ]
env:
TAG: ${{ inputs.imageTag }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to DockerHub
run: docker login -u thecloudtheory -p ${{ secrets.DOCKER_HUB_KEY }}
- name: Build the Docker image (latest)
if: ${{ env.TAG == '' }}
run: docker build . --file ./ace/Dockerfile --tag thecloudtheory/azure-cost-estimator:latest
- name: Build the Docker image (tag)
if: ${{ env.TAG != '' }}
run: docker build . --file ./ace/Dockerfile --tag thecloudtheory/azure-cost-estimator:$TAG
- name: Tag latest
if: ${{ env.TAG != '' }}
run: docker tag thecloudtheory/azure-cost-estimator:$TAG thecloudtheory/azure-cost-estimator:latest
- name: Push the Docker image
if: ${{ env.TAG != '' }}
run: docker push thecloudtheory/azure-cost-estimator:$TAG
- name: Push the Docker image (latest)
if: ${{ env.TAG == '' }}
run: docker push thecloudtheory/azure-cost-estimator:latest