forked from oracle-devrel/cd3-automation-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (29 loc) · 1023 Bytes
/
docker.yml
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
30
31
32
33
34
35
36
name: Build and Push Docker Image to Docker Hub
on:
push:
branches:
- main # Trigger the action when changes are pushed to the main branch
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v2
# Step 2: Set up Docker Buildx (optional but recommended for modern builds)
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Step 3: Log in to Docker Hub
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Step 4: Build the Docker image
- name: Build Docker image
run: |
docker buildx build -t ${{ secrets.DOCKER_USERNAME }}/cd3:latest .
# Step 5: Push Docker image to Docker Hub
- name: Push Docker image
run: |
docker push ${{ secrets.DOCKER_USERNAME }}/cd3:latest