Skip to content

Build and Push Docker Image #4

Build and Push Docker Image

Build and Push Docker Image #4

Workflow file for this run

name: Build and Push Docker Image
on:
workflow_run:
workflows: ["Go Test"]
types:
- completed
jobs:
build:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build Docker image
run: docker build -t ${{ secrets.DOCKER_USER }}/go-stack:${{ github.sha }} .
- name: Tag for latest
run: docker tag ${{ secrets.DOCKER_USER }}/go-stack:${{ github.sha }} ${{ secrets.DOCKER_USER }}/go-stack:latest
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Docker images
run: docker push --all-tags ${{ secrets.DOCKER_USER }}/go-stack