Skip to content

Commit

Permalink
Create cicd.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
gilmaimon authored Jul 26, 2024
1 parent 5f4ba80 commit abc74aa
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Push Docker Image

on:
push:
branches:
- '**' # Triggers on push to any branch
- '!master' # Exclude master branch
pull_request:
branches:
- master # Triggers on PR to master branch
workflow_dispatch: # Manually trigger the workflow

jobs:
build:
runs-on: ubuntu-latest

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

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

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

- name: Build Docker image
run: docker build -t server .

- name: Push Docker image
if: github.ref == 'refs/heads/master'
run: docker push server:latest

0 comments on commit abc74aa

Please sign in to comment.