-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
42 lines (33 loc) · 1.11 KB
/
docker-build.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
37
38
39
40
41
42
name: Push Docker Image to Docker Hub
on:
push:
branches:
- master
jobs:
push_to_docker_hub:
name: Push Docker Image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Checkout code
id: checkout_code
uses: actions/checkout@v3
- name: Login to Docker Hub
id: login_docker_hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER_NAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Echo Docker Hub Username
run: echo ${{ secrets.DOCKER_HUB_USER_NAME }}
- name: Echo GitHub SHA
run: echo $GITHUB_SHA
- name: Build Docker image
id: build_image
run: |
docker build "$GITHUB_WORKSPACE" -t ${{ secrets.DOCKER_HUB_USER_NAME }}/docker-osx:$GITHUB_SHA --label dockerfile-path="Dockerfile"
- name: Push Docker image
run: docker push ${{ secrets.DOCKER_HUB_USER_NAME }}/docker-osx
- name: Logout from Docker Hub
run: docker logout
- name: End
run: echo "Docker image pushed to Docker Hub successfully"