Skip to content

pushing image build to private ACR and public Docker Hub #8

pushing image build to private ACR and public Docker Hub

pushing image build to private ACR and public Docker Hub #8

Workflow file for this run

name: Build and Push to ACR
on:
push:
branches:
- 'main'
jobs:
build-and-push-to-acr:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4
- name: 'Build and push image to ACR'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
- run: |
docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:${{ github.sha }}
docker tag ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:${{ github.sha }} ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:latest
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:${{ github.sha }}
docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:latest
echo '--------------------'
docker inspect --format '
ID: {{.Id}}
RepoTags: {{.RepoTags}}
RepoDigests: {{.RepoDigests}}
Created: {{.Created}}
Author: {{.Author}}
Architecture: {{.Architecture}}
OS: {{.Os}}
Size: {{.Size}}
VirtualSize: {{.VirtualSize}}
Metadata: {{.Metadata}}
' ${{ secrets.REGISTRY_LOGIN_SERVER }}/ssl-checker-webapp:latest
echo '--------------------'
build-and-push-to-dockerhub:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: |
docker build . -t ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:${{ github.sha }}
docker tag ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:${{ github.sha }} ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:latest
docker push ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:${{ github.sha }}
docker push ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:latest
echo '--------------------'
docker inspect --format '
ID: {{.Id}}
RepoTags: {{.RepoTags}}
RepoDigests: {{.RepoDigests}}
Created: {{.Created}}
Author: {{.Author}}
Architecture: {{.Architecture}}
OS: {{.Os}}
Size: {{.Size}}
VirtualSize: {{.VirtualSize}}
Metadata: {{.Metadata}}
' ${{ secrets.DOCKERHUB_USERNAME }}/ssl-checker-webapp:latest
echo '--------------------'