forked from manoharrmnhr/samplejavaapp
-
Notifications
You must be signed in to change notification settings - Fork 0
29 lines (28 loc) · 874 Bytes
/
publish-docker-image.yaml
File metadata and controls
29 lines (28 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
name: Build and Push Docker Image
on:
workflow_dispatch: # Allow manual runs too
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repo
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Step 3: Set up Docker Buildx
- name: package
run: mvn package
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Step 4: Build and push the image
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/gh-demo:latest