-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush-image.yml
More file actions
86 lines (72 loc) · 2.17 KB
/
Copy pathpush-image.yml
File metadata and controls
86 lines (72 loc) · 2.17 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Push Image
on:
workflow_call:
inputs:
runs-on:
default: ubuntu-latest
required: false
type: string
description: Use runs-on to define the type of machine to run the job on.
build-args:
required: false
type: string
description: List of build args for docker
context:
required: false
type: string
description: Build's context is the set of files located in the specified PATH or URL
default: .
environment:
type: string
required: false
default: docker
description: The environment to deploy to.
image-name:
required: true
type: string
description: The name of image. EG "jgw/redis".
image-tag:
required: true
type: string
description: The tag of the image. EG '1.0.0'. Latest is always pushed as well.
registry:
required: false
type: string
description: Server address of Docker registry. If not set then will default to Docker Hub.
secrets:
DOCKER_REPO_USERNAME:
required: true
DOCKER_REPO_PASSWORD:
required: true
GH_TOKEN:
required: false
jobs:
push-image:
name: Push Image
runs-on: ${{ inputs.runs-on }}
environment: ${{ inputs.environment }}
steps:
- name: Checkout project
uses: actions/checkout@v6
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ${{ inputs.registry }}
username: ${{ secrets.DOCKER_REPO_USERNAME }}
password: ${{ secrets.DOCKER_REPO_PASSWORD }}
- name: Setup Docker
uses: docker/setup-buildx-action@v3
- name: Push to DockerHub
uses: docker/build-push-action@v6
with:
build-args: |
${{ inputs.build-args }}
GH_TOKEN=${{ secrets.GH_TOKEN || github.token }}
context: ${{ inputs.context }}
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
${{ inputs.image-name }}:${{ inputs.image-tag }}
${{ inputs.image-name }}:latest