Skip to content

Commit 0a0b5fa

Browse files
Builds, tags, and pushes to both Docker Hub and GHCR
1 parent 1ae887a commit 0a0b5fa

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
18+
- name: Login to Docker Hub
19+
uses: docker/login-action@v3
20+
with:
21+
username: ${{ secrets.DOCKERHUB_USERNAME }}
22+
password: ${{ secrets.DOCKERHUB_TOKEN }}
23+
24+
- name: Login to GHCR
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Build and push images
32+
uses: docker/build-push-action@v6
33+
with:
34+
push: true
35+
tags: |
36+
${{ secrets.DOCKERHUB_USERNAME }}/centralized-logging:latest
37+
ghcr.io/${{ github.repository_owner }}/centralized-logging:latest

0 commit comments

Comments
 (0)