File tree 3 files changed +13
-12
lines changed
3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ portainer终结点id,默认是1,即第一个,一般为localhost
23
23
** required** name of stack <br >
24
24
服务栈的名称,会在stacks列表里显示
25
25
26
+ ## registry
27
+ address of registry, like: myregistry.example.com (leave empty for Docker Hub) <br >
28
+
26
29
## imagename
27
30
** required** name of pull image, like: mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine <br >
28
31
将会进行拉取镜像的镜像名
@@ -54,7 +57,8 @@ The following will delete it if same name stack is existed.
54
57
password: ${{ secrets.PORTAINER_PASSWORD }}
55
58
endpointId: 1
56
59
stackname: dotnet_test
57
- imagename: mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine
60
+ registry: mcr.microsoft.com
61
+ imagename: dotnet/core/aspnet:3.1-alpine
58
62
docker_compose: |
59
63
version: "2"
60
64
services:
Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ inputs:
21
21
stackname :
22
22
description : ' name of stack, lowercase'
23
23
required : true
24
+ registry :
25
+ description : ' image registry'
26
+ required : false
27
+ default : ' '
24
28
imagename :
25
29
description : ' deploy image name'
26
30
required : true
Original file line number Diff line number Diff line change 31
31
# pull image
32
32
# 拉取镜像
33
33
echo " pull image: $INPUT_IMAGENAME "
34
- registry=$( echo " $INPUT_IMAGENAME " | awk -F' /' ' {print $1}' )
35
- if [[ " $registry " =~ " ." ]]
36
- then
37
- base64Registry=$( echo " {\" serveraddress\" :\" $registry \" }" | base64)
38
- curl --location --request POST ' ' ${INPUT_SERVERURL} ' /api/endpoints/' $INPUT_ENDPOINTID ' /docker/images/create?fromImage=' $INPUT_IMAGENAME ' ' \
39
- -H " Authorization: Bearer $token " -H " X-Registry-Auth: $base64Registry "
40
- else
41
- curl --location --request POST ' ' ${INPUT_SERVERURL} ' /api/endpoints/' $INPUT_ENDPOINTID ' /docker/images/create?fromImage=' $INPUT_IMAGENAME ' ' \
42
- -H " Authorization: Bearer $token "
43
- fi
34
+ base64Registry=$( echo " {\" serveraddress\" :\" $INPUT_REGISTRY \" }" | base64)
35
+ curl --location --request POST ' ' ${INPUT_SERVERURL} ' /api/endpoints/' $INPUT_ENDPOINTID ' /docker/images/create?fromImage=' $INPUT_IMAGENAME ' ' \
36
+ -H " Authorization: Bearer $token " -H " X-Registry-Auth: $base64Registry "
44
37
45
38
46
39
@@ -107,4 +100,4 @@ if [ "$message" != "null" ]; then
107
100
echo " create failed: $message "
108
101
exit 1
109
102
fi
110
- exit 0
103
+ exit 0
You can’t perform that action at this time.
0 commit comments