-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
93 lines (88 loc) · 3.11 KB
/
action.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
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
87
88
89
90
91
92
# Copyright (c) 2022 OpenFaaS Ltd
name: 'hub-mirror'
description: 'Setup local mirror for Docker Hub'
branding:
icon: 'arrow-right-circle'
color: 'gray-dark'
inputs:
insecureRegistries:
description: 'The gateway hostname address or IP address.'
required: true
default: ""
registryMirrors:
description: 'Registry mirrors for the Docker daemon.'
required: true
default: "\"https://192.168.128.1:5000\""
buildkitRegistryMirror:
description: 'Registry mirror to be used by buildx builder.'
required: true
default: "\"192.168.128.1:5000\""
buildkitRegistryHTTP:
description: 'Whether to use HTTP instead of HTTPS.'
required: true
default: "false"
buildkitRegistryInsecure:
description: 'Whether to use TLS.'
required: true
default: "false"
runs:
using: 'composite'
steps:
- name: Setup config
shell: bash
id: setup-config
env:
INSECURE_REG: ${{ inputs.insecureRegistries }}
REG_MIRRORS: ${{ inputs.registryMirrors }}
run: |
sudo mkdir -p /etc/docker
if [ -n "$INSECURE_REG" ] ; then
cat <<EOF | sudo tee /etc/docker/daemon.json
{
"insecure-registries" : [${INSECURE_REG} ],
"registry-mirrors": [${REG_MIRRORS}]
}
EOF
else
cat <<EOF | sudo tee /etc/docker/daemon.json
{
"registry-mirrors": [${REG_MIRRORS}]
}
EOF
fi
- name: Reload Docker
shell: bash
id: reload-docker
run: |
sudo cat /etc/docker/daemon.json
sudo systemctl daemon-reload && sudo systemctl restart docker
# Step with http and insecure sections included
- name: Configure buildx with insecure registry
if: ${{ inputs.buildkitRegistryInsecure == 'true' }}
uses: docker/setup-buildx-action@v3
with:
# AE: This appeared to have an issue for a user, so it's being set to
# false for now.
cache-binary: false
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = [${{ inputs.buildkitRegistryMirror }}]
http = ${{ inputs.buildkitRegistryHTTP }}
insecure = ${{ inputs.buildkitRegistryInsecure }}
[registry.${{ inputs.buildkitRegistryMirror }}]
http = ${{ inputs.buildkitRegistryHTTP }}
insecure = ${{ inputs.buildkitRegistryInsecure }}
# Step without http and insecure sections
- name: Configure buildx without insecure registry
if: ${{ inputs.buildkitRegistryInsecure != 'true' }}
uses: docker/setup-buildx-action@v3
with:
# AE: This appeared to have an issue for a user, so it's being set to
# false for now.
cache-binary: false
buildkitd-config-inline: |
[registry."docker.io"]
mirrors = [${{ inputs.buildkitRegistryMirror }}]
ca = ["/runner/ca.crt"]
[registry.${{ inputs.buildkitRegistryMirror }}]
ca = ["/runner/ca.crt"]