Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
MrNaif2018 committed Jan 24, 2023
2 parents 389b543 + 616392c commit 6f14158
Show file tree
Hide file tree
Showing 17 changed files with 316 additions and 531 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ name: Release assets
on:
push:
tags:
- '*.*.*'
- "*.*.*"

jobs:
assets:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-go@v2

- uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: "1.19"

- name: Build release assets
run: make release

- name: Upload release assets
uses: alexellis/upload-assets@0.3.0
uses: alexellis/upload-assets@0.4.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_paths: '["./docker-gen-*.tar.gz"]'

- name: Cleanup release assets
run: make dist-clean
57 changes: 29 additions & 28 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
@@ -1,100 +1,101 @@
name: DockerHub

on:
workflow_dispatch:
push:
tags:
- '*.*.*'
- "*.*.*"
paths:
- '.dockerignore'
- '.github/workflows/dockerhub.yml'
- 'Dockerfile'
- 'Dockerfile.debian'
- 'go.mod'
- 'go.sum'
- '**.go'
- ".dockerignore"
- ".github/workflows/dockerhub.yml"
- "Dockerfile"
- "Dockerfile.debian"
- "go.mod"
- "go.sum"
- "**.go"

jobs:
multiarch-build:
strategy:
matrix:
base: [alpine, debian]
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Retrieve version
run: echo "GIT_DESCRIBE=$(git describe --tags)" >> $GITHUB_ENV

- name: Get Docker tags for Alpine based image
if: ${{ matrix.base == 'alpine' }}
id: docker_meta_alpine
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.DOCKER_REPO }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=raw,value=latest,enable={{is_default_branch}}
labels: |
org.opencontainers.image.authors=Nicolas Duchon <[email protected]> (@buchdag), Jason Wilder
org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
- name: Get Docker tags for Debian based image
if: ${{ matrix.base == 'debian' }}
id: docker_meta_debian
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.DOCKER_REPO }}
tags: |
type=semver,suffix=-debian,pattern={{version}}
type=semver,suffix=-debian,pattern={{major}}.{{minor}}
type=raw,value=debian,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
type=raw,value=debian,enable={{is_default_branch}}
labels: |
org.opencontainers.image.authors=Nicolas Duchon <[email protected]> (@buchdag), Jason Wilder
org.opencontainers.image.version=${{ env.GIT_DESCRIBE }}
flavor: latest=false

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the Alpine based image
if: ${{ matrix.base == 'alpine' }}
id: docker_build_alpine
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: .
build-args: DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.docker_meta_alpine.outputs.tags }}
labels: ${{ steps.docker_meta_alpine.outputs.labels }}

- name: Build and push the Debian based image
if: ${{ matrix.base == 'debian' }}
id: docker_build_debian
uses: docker/build-push-action@v2
uses: docker/build-push-action@v3
with:
context: .
build-args: DOCKER_GEN_VERSION=${{ env.GIT_DESCRIBE }}
Expand All @@ -107,7 +108,7 @@ jobs:
- name: Alpine based image digest
if: ${{ matrix.base == 'alpine' }}
run: echo ${{ steps.docker_build_alpine.outputs.digest }}

- name: Debian based image digest
if: ${{ matrix.base == 'debian' }}
run: echo ${{ steps.docker_build_debian.outputs.digest }}
24 changes: 12 additions & 12 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ name: Tests
on:
push:
paths-ignore:
- 'LICENSE'
- '**.md'
- 'examples/*'
- 'templates/*'
- "LICENSE"
- "**.md"
- "examples/*"
- "templates/*"
pull_request:
paths-ignore:
- 'LICENSE'
- '**.md'
- 'examples/*'
- 'templates/*'
- "LICENSE"
- "**.md"
- "examples/*"
- "templates/*"

jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v2

- uses: actions/setup-go@v3
with:
go-version: '1.18'
go-version: "1.19"

- name: Install dependencies
run: make get-deps
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG DOCKER_GEN_VERSION=main

# Build docker-gen from scratch
FROM golang:1.18.1-alpine as go-builder
FROM golang:1.19.5-alpine as go-builder

ARG DOCKER_GEN_VERSION
WORKDIR /build
Expand All @@ -13,7 +13,7 @@ RUN go mod download
# Build the docker-gen executable
RUN GOOS=linux CGO_ENABLED=0 go build -ldflags "-X main.buildVersion=${DOCKER_GEN_VERSION}" -o docker-gen ./cmd/docker-gen

FROM alpine:3.15.4
FROM alpine:3.17.1

ARG DOCKER_GEN_VERSION
ENV DOCKER_GEN_VERSION=${DOCKER_GEN_VERSION} \
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG DOCKER_GEN_VERSION=main

# Build docker-gen from scratch
FROM golang:1.18.1 as go-builder
FROM golang:1.19.5 as go-builder

ARG DOCKER_GEN_VERSION

Expand All @@ -14,7 +14,7 @@ RUN go mod download
# Build the docker-gen executable
RUN GOOS=linux go build -ldflags "-X main.buildVersion=${DOCKER_GEN_VERSION}" -o docker-gen ./cmd/docker-gen

FROM debian:11.3-slim
FROM debian:11.6-slim

ARG VERSION
ENV DOCKER_GEN_VERSION=${VERSION} \
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ There are three common ways to run docker-gen:

#### Host Install

Linux/OSX binaries for release [0.7.6](https://github.com/nginx-proxy/docker-gen/releases)
Linux/OSX binaries for release [0.9.0](https://github.com/nginx-proxy/docker-gen/releases)

* [amd64](https://github.com/nginx-proxy/docker-gen/releases/download/0.7.6/docker-gen-linux-amd64-0.7.6.tar.gz)
* [i386](https://github.com/nginx-proxy/docker-gen/releases/download/0.7.6/docker-gen-linux-i386-0.7.6.tar.gz)
* [alpine-linux](https://github.com/nginx-proxy/docker-gen/releases/download/0.7.6/docker-gen-alpine-linux-amd64-0.7.6.tar.gz)
* [amd64](https://github.com/nginx-proxy/docker-gen/releases/download/0.9.0/docker-gen-linux-amd64-0.9.0.tar.gz)
* [i386](https://github.com/nginx-proxy/docker-gen/releases/download/0.9.0/docker-gen-linux-i386-0.9.0.tar.gz)
* [alpine-linux](https://github.com/nginx-proxy/docker-gen/releases/download/0.9.0/docker-gen-alpine-linux-amd64-0.9.0.tar.gz)

Download the version you need, untar, and install to your PATH.

```
$ wget https://github.com/nginx-proxy/docker-gen/releases/download/0.7.6/docker-gen-linux-amd64-0.7.6.tar.gz
$ tar xvzf docker-gen-linux-amd64-0.7.6.tar.gz
$ wget https://github.com/nginx-proxy/docker-gen/releases/download/0.9.0/docker-gen-linux-amd64-0.9.0.tar.gz
$ tar xvzf docker-gen-linux-amd64-0.9.0.tar.gz
$ ./docker-gen
```

Expand Down Expand Up @@ -361,6 +361,7 @@ For example, this is a JSON version of an emitted RuntimeContainer struct:
* *`contains $map $key`*: Returns `true` if `$map` contains `$key`. Takes maps from `string` to any type.
* *`dir $path`*: Returns an array of filenames in the specified `$path`.
* *`exists $path`*: Returns `true` if `$path` refers to an existing file or directory. Takes a string.
* *`eval $templateName [$data]`*: Evaluates the named template like Go's built-in `template` action, but instead of writing out the result it returns the result as a string so that it can be post-processed. The `$data` argument may be omitted, which is equivalent to passing `nil`.
* *`groupBy $containers $fieldPath`*: Groups an array of `RuntimeContainer` instances based on the values of a field path expression `$fieldPath`. A field path expression is a dot-delimited list of map keys or struct member names specifying the path from container to a nested value, which must be a string. Returns a map from the value of the field path expression to an array of containers having that value. Containers that do not have a value for the field path in question are omitted.
* *`groupByKeys $containers $fieldPath`*: Returns the same as `groupBy` but only returns the keys of the map.
* *`groupByMulti $containers $fieldPath $sep`*: Like `groupBy`, but the string value specified by `$fieldPath` is first split by `$sep` into a list of strings. A container whose `$fieldPath` value contains a list of strings will show up in the map output under each of those strings.
Expand Down
42 changes: 22 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
module github.com/nginx-proxy/docker-gen

go 1.18
go 1.19

require (
github.com/BurntSushi/toml v1.1.0
github.com/Masterminds/sprig/v3 v3.2.2
github.com/fsouza/go-dockerclient v1.7.10
github.com/stretchr/testify v1.7.1
github.com/BurntSushi/toml v1.2.1
github.com/Masterminds/sprig/v3 v3.2.3
github.com/fsouza/go-dockerclient v1.9.3
github.com/stretchr/testify v1.8.1
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/hcsshim v0.9.2 // indirect
github.com/containerd/cgroups v1.0.3 // indirect
github.com/containerd/containerd v1.6.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/Microsoft/hcsshim v0.9.6 // indirect
github.com/containerd/cgroups v1.0.4 // indirect
github.com/containerd/containerd v1.6.14 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/docker v20.10.12+incompatible // indirect
github.com/docker/docker v20.10.23+incompatible // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/docker/go-units v0.5.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/huandu/xstrings v1.3.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/moby/sys/mount v0.2.0 // indirect
github.com/moby/sys/mountinfo v0.5.0 // indirect
github.com/moby/sys/mount v0.3.3 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect
github.com/opencontainers/runc v1.1.0 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
github.com/opencontainers/runc v1.1.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/cast v1.3.1 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
golang.org/x/crypto v0.3.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/sys v0.2.0 // indirect
golang.org/x/tools v0.1.12 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 6f14158

Please sign in to comment.