Docker gen multiarch images
This commit is contained in:
parent
ccceeb6e81
commit
0f6717adad
13
.github/workflows/build-publish.yml
vendored
13
.github/workflows/build-publish.yml
vendored
@ -2,18 +2,13 @@ name: Build and publish Docker images
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: "0 0 * * 1"
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "*.*.*"
|
||||
paths:
|
||||
- ".dockerignore"
|
||||
- ".github/workflows/build-publish.yml"
|
||||
- "Dockerfile"
|
||||
- "Dockerfile.debian"
|
||||
- "go.mod"
|
||||
- "go.sum"
|
||||
- "**.go"
|
||||
@ -23,7 +18,7 @@ jobs:
|
||||
name: Build and publish image
|
||||
strategy:
|
||||
matrix:
|
||||
base: [alpine, debian]
|
||||
base: [alpine]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@ -41,9 +36,7 @@ jobs:
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/nginx-proxy/docker-gen
|
||||
nginxproxy/docker-gen
|
||||
jwilder/docker-gen
|
||||
btcpayserver/docker-gen
|
||||
tags: |
|
||||
type=semver,pattern={{version}},enable=${{ matrix.base == 'alpine' }}
|
||||
type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.base == 'alpine' }}
|
||||
@ -82,7 +75,7 @@ jobs:
|
||||
with:
|
||||
context: .
|
||||
build-args: DOCKER_GEN_VERSION=${{ steps.docker-gen_version.outputs.VERSION }}
|
||||
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
file: Dockerfile.${{ matrix.base }}
|
||||
push: true
|
||||
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||
|
||||
@ -125,6 +125,16 @@ func coalesce(input ...interface{}) interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// coalesceempty returns the first non nil argument or empty
|
||||
func coalesceempty(input ...interface{}) interface{} {
|
||||
for _, v := range input {
|
||||
if v != nil && len(fmt.Sprintf("%v", v)) > 0 {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// trimPrefix returns a string without the prefix, if present
|
||||
func trimPrefix(prefix, s string) string {
|
||||
return strings.TrimPrefix(s, prefix)
|
||||
|
||||
@ -40,7 +40,9 @@ func groupByMulti(entries interface{}, key, sep string) (map[string][]interface{
|
||||
return generalizedGroupByKey("groupByMulti", entries, key, func(groups map[string][]interface{}, value interface{}, v interface{}) {
|
||||
items := strings.Split(value.(string), sep)
|
||||
for _, item := range items {
|
||||
groups[item] = append(groups[item], v)
|
||||
if item != "" {
|
||||
groups[item] = append(groups[item], v)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -23,6 +23,21 @@ import (
|
||||
"github.com/nginx-proxy/docker-gen/internal/utils"
|
||||
)
|
||||
|
||||
func read(path string) (string, error) {
|
||||
_, err := os.Stat(path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return "", nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
b, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(b), nil
|
||||
}
|
||||
|
||||
func getArrayValues(funcName string, entries interface{}) (*reflect.Value, error) {
|
||||
entriesVal := reflect.ValueOf(entries)
|
||||
|
||||
@ -61,10 +76,12 @@ func newTemplate(name string) *template.Template {
|
||||
tmpl.Funcs(sprig.TxtFuncMap()).Funcs(template.FuncMap{
|
||||
"closest": arrayClosest,
|
||||
"coalesce": coalesce,
|
||||
"coalesceempty": coalesceempty,
|
||||
"contains": contains,
|
||||
"dir": dirList,
|
||||
"eval": eval,
|
||||
"exists": utils.PathExists,
|
||||
"read": read,
|
||||
"groupBy": groupBy,
|
||||
"groupByKeys": groupByKeys,
|
||||
"groupByMulti": groupByMulti,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user