Tag Archives: github-actions

Publish Docker image to Docker Hub using GitHub Actions

Github Actions script docker-image.yml

name: Docker Image CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: docker login
env:
DOCKER_USER: ${{secrets.DOCKER_USER}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: Build the Docker image
run: docker build . --file Dockerfile --tag bezhav/megacli:v1

- name: Docker Push
run: docker push bezhav/megacli:v1