Build Image and Publish to GCR #10
Workflow file for this run
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: Build Image and Publish to GCR | |
on: | |
workflow_dispatch : | |
# workflow_call: | |
inputs: | |
environment: | |
type: string | |
required: true | |
#on: | |
# push: | |
# branches: [ "main" ] | |
env: | |
DOCKER_IMAGE: sts-knowledgebase | |
jobs: | |
build-image: | |
runs-on: ubuntu-22.04 | |
name: Build & Publish Image | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- name: Get GitHub Runner IP | |
id: whats-my-ip | |
uses: ./.github/actions/whats-my-ip-address | |
- name: GitHub Container Registry Login | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Image & Publish To GCR | |
uses: docker/build-push-action@v4 | |
with: | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
registry: docker.pkg.github.com | |
context: ./ | |
file: ./src/App/Dockerfile | |
run: | | |
docker build . --tag ghcr.io/dfe-digital/sts-knowledgebase/App:latest | |
docker push ghcr.io/dfe-digital/sts-knowledgebase/App:latest | |
tags: | | |
ghcr.io/dfe-digital/${{ env.DOCKER_IMAGE}} | |
push: true | |