Skip to content

Commit 3db8ff2

Browse files
authored
Update action.yml
1 parent 86f3724 commit 3db8ff2

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

action.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,23 @@ inputs:
88
insecureRegistries:
99
description: 'The gateway hostname address or IP address.'
1010
required: true
11-
default: "\"192.168.128.1:5000\""
11+
default: ""
1212
registryMirrors:
13-
description: 'Whether to use TLS.'
13+
description: 'Registry mirrors for the Docker daemon.'
1414
required: true
15-
default: "\"http://192.168.128.1:5000\""
15+
default: "\"https://192.168.128.1:5000\""
1616
buildkitRegistryMirror:
1717
description: 'Registry mirror to be used by buildx builder.'
1818
required: true
1919
default: "\"192.168.128.1:5000\""
2020
buildkitRegistryHTTP:
21-
description: 'Whether to us HTTP.'
21+
description: 'Whether to use HTTP instead of HTTPS.'
2222
required: true
23-
default: "true"
23+
default: "false"
2424
buildkitRegistryInsecure:
2525
description: 'Whether to use TLS.'
2626
required: true
27-
default: "true"
27+
default: "false"
2828

2929
runs:
3030
using: 'composite'
@@ -37,19 +37,31 @@ runs:
3737
REG_MIRRORS: ${{ inputs.registryMirrors }}
3838
run: |
3939
sudo mkdir -p /etc/docker
40-
cat <<EOF | sudo tee /etc/docker/daemon.json
41-
{
42-
"insecure-registries" : [${INSECURE_REG} ],
43-
"registry-mirrors": [${REG_MIRRORS}]
44-
}
45-
EOF
40+
if [ -n "$INSECURE_REG" ] ; then
41+
cat <<EOF | sudo tee /etc/docker/daemon.json
42+
{
43+
"insecure-registries" : [${INSECURE_REG} ],
44+
"registry-mirrors": [${REG_MIRRORS}]
45+
}
46+
EOF
47+
else
48+
if [ -n $INSECURE_REG ] ;
49+
cat <<EOF | sudo tee /etc/docker/daemon.json
50+
{
51+
"registry-mirrors": [${REG_MIRRORS}]
52+
}
53+
EOF
54+
fi
4655
- name: Reload Docker
4756
shell: bash
4857
id: reload-docker
4958
run: |
5059
sudo cat /etc/docker/daemon.json
5160
sudo systemctl daemon-reload && sudo systemctl restart docker
52-
- name: Configure buildx
61+
62+
# Step with http and insecure sections included
63+
- name: Configure buildx with insecure registry
64+
if: ${{ inputs.buildkitRegistryInsecure == 'true' }}
5365
uses: docker/setup-buildx-action@v3
5466
with:
5567
# AE: This appeared to have an issue for a user, so it's being set to
@@ -63,3 +75,16 @@ runs:
6375
[registry.${{ inputs.buildkitRegistryMirror }}]
6476
http = ${{ inputs.buildkitRegistryHTTP }}
6577
insecure = ${{ inputs.buildkitRegistryInsecure }}
78+
79+
# Step without http and insecure sections
80+
- name: Configure buildx without insecure registry
81+
if: ${{ inputs.buildkitRegistryInsecure != 'true' }}
82+
uses: docker/setup-buildx-action@v3
83+
with:
84+
# AE: This appeared to have an issue for a user, so it's being set to
85+
# false for now.
86+
cache-binary: false
87+
buildkitd-config-inline: |
88+
[registry."docker.io"]
89+
mirrors = [${{ inputs.buildkitRegistryMirror }}]
90+
[registry.${{ inputs.buildkitRegistryMirror }}]

0 commit comments

Comments
 (0)