Skip to content

Commit

Permalink
Updated docker build and push
Browse files Browse the repository at this point in the history
  • Loading branch information
zarif98 committed Aug 2, 2024
1 parent 11b9d47 commit c392532
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
name: Docker Build
name: Docker Build and Push

on:
push:
branches: [ "main" ] # Adjust this if you want to trigger on a different branch
branches: [ "master" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Build Docker image
run: docker build -t my-reddit-monitor .
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit c392532

Please sign in to comment.