Skip to content

Commit

Permalink
Create docker-build-push.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Sid-Sun authored Aug 16, 2024
1 parent 5cae67a commit 182512b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Docker Image Build and Push CI

on:
push:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract Docker base image tag
id: extract_tag
run: |
TAG=$(grep '^FROM ' Dockerfile | awk -F ':' '{print $2}')
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Build and push Docker image
run: |
docker build . --file Dockerfile --tag realsidsun/replicator-kuma:$TAG
docker build -t your-dockerhub-username/bar:$TAG .
docker push your-dockerhub-username/bar:$TAG

0 comments on commit 182512b

Please sign in to comment.