Skip to content

Merge pull request #23 from awaismohammad23/awaismohammad23-patch-6 #8

Merge pull request #23 from awaismohammad23/awaismohammad23-patch-6

Merge pull request #23 from awaismohammad23/awaismohammad23-patch-6 #8

Workflow file for this run

name: Docker Build and Push
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Build Docker image
run: |
go mod init github.com/${{ secrets.DOCKER_HUB_USERNAME }}/blockchain-assignment-1-2
go build -o myapp
docker build -t ${{ secrets.DOCKER_HUB_USERNAME }}/blockchain-assignment-1-2:latest -t ${{ secrets.DOCKER_HUB_USERNAME }}/blockchain-assignment-1-2:${{ github.sha }} .
- name: Push Docker image to Docker Hub
run: |
echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/blockchain-assignment-1-2:latest