Skip to content

Instantly share code, notes, and snippets.

@parjun8840
Last active January 21, 2023 13:55
Show Gist options
  • Save parjun8840/ac97502924caf53075b6085d67e6255e to your computer and use it in GitHub Desktop.
Save parjun8840/ac97502924caf53075b6085d67e6255e to your computer and use it in GitHub Desktop.
docker image build and push
# .github/workflows/dockerbuild.yaml
on:
push:
branches:
- main
paths:
- 'dockerimage/**'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./dockerimage
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Login to Docker Hub or image repository
#if: github.ref_type == 'tag'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./dockerimage
file: ./dockerimage/Dockerfile
push: true
tags: parjun8840/gha:${{ github.sha }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment