Skip to content

Commit 2adef44

Browse files
committed
publish golangci-lint and scout-cli
Signed-off-by: Yves Brissaud <[email protected]>
1 parent 444d103 commit 2adef44

File tree

9 files changed

+366
-0
lines changed

9 files changed

+366
-0
lines changed

.github/workflows/decorate.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Decorate
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
img:
7+
type: string
8+
description: Name of the image/sub folder
9+
workflow_call:
10+
inputs:
11+
img:
12+
type: string
13+
required: true
14+
15+
env:
16+
NAMESPACE: eunomie
17+
18+
jobs:
19+
decorate:
20+
name: Decorate ${{ inputs.img }}
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: docker/login-action@v2
25+
with:
26+
username: ${{ secrets.DOCKER_HUB_USER }}
27+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
28+
- name: Install docker runx
29+
run: |
30+
curl -sSfL https://raw.githubusercontent.com/eunomie/docker-runx/main/install.sh | sh -s --
31+
- name: Decorate
32+
working-directory: ${{ inputs.img }}
33+
run: |
34+
docker runx decorate `cat image` -t ${{ env.NAMESPACE }}/${{ inputs.img }}
35+
# - name: Docker Hub Description
36+
# uses: peter-evans/dockerhub-description@v4
37+
# with:
38+
# username: ${{ secrets.DOCKER_HUB_USER }}
39+
# password: ${{ secrets.DOCKER_HUB_TOKEN }}
40+
# repository: ${{ env.NAMESPACE }}/${{ inputs.img }}
41+
# readme-filepath: ${{ inputs.img }}/README.md

.github/workflows/push.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Push
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
env:
14+
NAMESPACE: eunomie
15+
16+
jobs:
17+
changes:
18+
name: Check for changes
19+
runs-on: ubuntu-latest
20+
outputs:
21+
changes: ${{ steps.changes.outputs.changes }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: dorny/paths-filter@v3
25+
id: changes
26+
with:
27+
filters: |
28+
golangci-lint:
29+
- 'golangci-lint/*'
30+
scout-cli:
31+
- 'scout-cli/*'
32+
decorate:
33+
name: Decorate images
34+
needs: changes
35+
if: ${{ needs.changes.outputs.changes != '[]' }}
36+
strategy:
37+
matrix:
38+
img: ${{ fromJSON(needs.changes.outputs.changes) }}
39+
uses: ./.github/workflows/decorate.yaml
40+
with:
41+
img: ${{ matrix.img }}
42+
secrets: inherit

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# runx-images
2+
3+
## Overview
4+
5+
This is a collection of [docker runx](https://github.com/eunomie/runx) compatible images.
6+
7+
Those images can be used without `runx`, like with `docker run` or `docker compose` for instance. In this case they are just mirrors of the official images.
8+
9+
Explore the documentation of each image to know more and learn how to use them with `docker runx IMAGE --docs`.
10+
11+
List the available commands using `docker runx IMAGE --list` or get detailed information about an action using `docker runx IMAGE ACTION --docs`.
12+
13+
Then simply run the image with `docker runx IMAGE [ACTION]`.
14+
15+
## Images
16+
17+
- [golangci-lint](./golangci-lint): A Docker image for [golangci-lint](https://golangci-lint.run/) with some defaults and caching enabled
18+
```
19+
$ docker runx eunomie/golangci-lint --docs
20+
```
21+
- [scout-cli](./scout-cli): A Docker image for [Docker Scout CLI](https://docs.docker.com/engine/reference/commandline/scout/) to showcase how to use it
22+
```
23+
$ docker runx eunomie/scout-cli --docs
24+
```
25+
26+
Images are available on [Docker Hub](https://hub.docker.com/u/eunomie).

golangci-lint/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# golangci-lint
2+
3+
4+
- [License](https://github.com/golangci/golangci-lint/blob/master/LICENSE)
5+
- [Release](https://github.com/golangci/golangci-lint/releases/latest)
6+
- [Docker](https://hub.docker.com/r/golangci/golangci-lint)
7+
- [GitHub Releases Stats of golangci-lint](https://somsubhra.github.io/github-release-stats/?username=golangci&repository=golangci-lint)
8+
9+
`golangci-lint` is a fast linters runner for Go.
10+
11+
It runs linters in parallel, uses caching, supports YAML configuration,
12+
integrates with all major IDEs, and includes over a hundred linters.
13+
14+
Join our slack channel by [joining Gophers workspace](https://invite.slack.golangbridge.org/)
15+
and then [joining](https://gophers.slack.com/archives/CS0TBRKPC) channel [`#golangci-lint`](https://gophers.slack.com/archives/CS0TBRKPC).
16+
17+
Follow the news and releases:
18+
19+
- [Follow on Mastodon](https://fosstodon.org/@golangcilint)
20+
- [Follow on Twitter](https://twitter.com/golangci)
21+
22+
## Features
23+
24+
-[Very fast](https://golangci-lint.run/product/performance): runs linters in parallel, reuses Go build cache and caches analysis results.
25+
- ⚙️ YAML-based [configuration](https://golangci-lint.run/usage/configuration).
26+
- 🖥 [Integrations](https://golangci-lint.run/welcome/integrations) with VS Code, Sublime Text, GoLand, GNU Emacs, Vim, GitHub Actions.
27+
- 🥇 [A lot of linters](https://golangci-lint.run/usage/linters) included, no need to install them.
28+
- 📈 Minimum number of [false positives](https://golangci-lint.run/usage/false-positives) because of tuned default settings.
29+
- 🔥 Nice output with colors, source code lines and marked `identifiers`.
30+
31+
[Get started now!](https://golangci-lint.run/welcome/install)
32+
33+
### Docker
34+
35+
```sh
36+
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
37+
```
38+
39+
Preserving cache between consecutive runs:
40+
```sh
41+
docker run --rm -v $(pwd):/app -v ~/.cache/golangci-lint/{.LatestVersion}:/root/.cache -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
42+
```
43+
44+
Colored output:
45+
```sh
46+
docker run -t --rm -v $(pwd):/app -w /app golangci/golangci-lint:{.LatestVersion} golangci-lint run -v
47+
```
48+
49+
## Supporting Us
50+
51+
- [Open Collective backers and sponsors](https://opencollective.com/golangci-lint)
52+
- [GitHub Sponsors](https://github.com/sponsors/golangci)
53+
- [Linter Authors](https://golangci-lint.run/product/thanks/)
54+
55+
`golangci-lint` is a free and open-source project built by volunteers.
56+
57+
If you value it, consider supporting us, we appreciate it! ❤️

golangci-lint/image

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
golangci/golangci-lint:latest

golangci-lint/runx.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
default: lint
2+
actions:
3+
- id: lint
4+
desc: Run golangci-lint on your local folder
5+
type: run
6+
shell:
7+
pwd: pwd
8+
gopath: go env GOPATH
9+
gocache: go env GOCACHE
10+
cmd: >
11+
--rm
12+
{{if .IsTTY}}-t{{end}}
13+
-v {{sh "pwd"}}:/app
14+
-v {{sh "gopath"}}/pkg:/go/pkg
15+
-v {{sh "gocache"}}:/cache/go
16+
-e GOFLAGS=-buildvcs=false
17+
-e GOCACHE=/cache/go
18+
-e GOLANGCI_LINT_CACHE=/cache/go
19+
-w /app
20+
{{.Ref}}
21+
golangci-lint run --timeout 5m
22+
23+
- id: with-config
24+
desc: Run golangci-lint with a specific config file
25+
type: run
26+
shell:
27+
pwd: pwd
28+
gopath: go env GOPATH
29+
gocache: go env GOCACHE
30+
opts:
31+
- name: config
32+
desc: The path to the golangci-lint config file
33+
prompt: Please enter the path to the config file
34+
required: true
35+
cmd: >
36+
--rm
37+
{{if .IsTTY}}-t{{end}}
38+
-v {{sh "pwd"}}:/app
39+
-v {{sh "gopath"}}/pkg:/go/pkg
40+
-v {{sh "gocache"}}:/cache/go
41+
--mount type=bind,source={{sh "pwd"}}/{{opt "config"}},target=/.golangci.yml
42+
-e GOFLAGS=-buildvcs=false
43+
-e GOCACHE=/cache/go
44+
-e GOLANGCI_LINT_CACHE=/cache/go
45+
-w /app
46+
{{.Ref}}
47+
golangci-lint run -c /.golangci.yml --timeout 5m

scout-cli/README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Docker Scout
2+
3+
This image bundles the Docker Scout CLI.
4+
5+
Read more about the CLI at https://docs.docker.com/engine/reference/commandline/scout/.
6+
7+
## Usage
8+
9+
To run the CLI you need to be authenticated with Docker Hub.
10+
To pass your credentials to Docker Scout CLI, pass the following environment variables:
11+
- `DOCKER_SCOUT_HUB_USER`: Your Docker Hub user name.
12+
- `DOCKER_SCOUT_HUB_PASSWORD`: Your Docker Hub Personal Access Token (PAT).
13+
14+
You can then run the CLI with the following command:
15+
16+
```console
17+
$ docker run -it \
18+
-e DOCKER_SCOUT_HUB_USER=<your Docker Hub user name> \
19+
-e DOCKER_SCOUT_HUB_PASSWORD=<your Docker Hub PAT> \
20+
docker/scout-cli <sub command>
21+
```
22+
23+
Run the `docker/scout-cli` image with the `--help` flag (or with no sub command) to see the available sub commands.
24+
25+
```console
26+
$ docker run -it docker/scout-cli --help
27+
```
28+
29+
If you want to access local images, you need to mount the Docker socket:
30+
31+
```console
32+
$ docker run -it \
33+
-e DOCKER_SCOUT_HUB_USER \
34+
-e DOCKER_SCOUT_HUB_PASSWORD \
35+
-u root \
36+
-v /var/run/docker.sock:/var/run/docker.sock \
37+
docker/scout-cli <sub command>
38+
```
39+
40+
## Customization
41+
42+
If you want to always run the CLI for your organization namespace, create a `.docker/runx.yaml` file in your current folder with the following content:
43+
44+
```yaml
45+
images:
46+
runx/scout-cli:
47+
all-actions:
48+
opts:
49+
org: <your organization>
50+
```

scout-cli/image

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker/scout-cli:latest

scout-cli/runx.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
actions:
2+
- id: help
3+
desc: Print Docker Scout CLI help
4+
type: run
5+
cmd: >
6+
--rm {{if .IsTTY}}-it{{end}}
7+
{{.Ref}} help
8+
9+
- id: self
10+
desc: Run quickview against the image itself
11+
type: run
12+
env:
13+
- DOCKER_SCOUT_HUB_USER
14+
- DOCKER_SCOUT_HUB_PASSWORD
15+
opts:
16+
- name: org
17+
desc: Your organization (Docker Hub namespace)
18+
no-prompt: true
19+
required: false
20+
cmd: >
21+
{{$org := opt "org"}}
22+
-e DOCKER_SCOUT_HUB_USER
23+
-e DOCKER_SCOUT_HUB_PASSWORD
24+
-u root
25+
-v /var/run/docker.sock:/var/run/docker.sock
26+
--rm {{if .IsTTY}}-it{{end}}
27+
{{.Ref}} quickview {{if $org}}--org {{$org}}{{end}} {{.Ref}}
28+
29+
- id: qv
30+
desc: Run docker scout quickview command
31+
type: run
32+
env:
33+
- DOCKER_SCOUT_HUB_USER
34+
- DOCKER_SCOUT_HUB_PASSWORD
35+
opts:
36+
- name: org
37+
desc: Your organization (Docker Hub namespace)
38+
no-prompt: true
39+
required: false
40+
- name: ref
41+
desc: The image reference
42+
prompt: Please enter the image reference
43+
required: true
44+
cmd: >
45+
{{$org := opt "org"}}
46+
-e DOCKER_SCOUT_HUB_USER
47+
-e DOCKER_SCOUT_HUB_PASSWORD
48+
-u root
49+
-v /var/run/docker.sock:/var/run/docker.sock
50+
--rm {{if .IsTTY}}-it{{end}}
51+
{{.Ref}} quickview {{if $org}}--org {{$org}}{{end}} {{opt "ref"}}
52+
53+
- id: cves
54+
desc: Run docker scout cves command
55+
type: run
56+
env:
57+
- DOCKER_SCOUT_HUB_USER
58+
- DOCKER_SCOUT_HUB_PASSWORD
59+
opts:
60+
- name: org
61+
desc: Your organization (Docker Hub namespace)
62+
no-prompt: true
63+
required: false
64+
- name: ref
65+
desc: The image reference
66+
prompt: Please enter the image reference
67+
required: true
68+
cmd: >
69+
{{$org := opt "org"}}
70+
-e DOCKER_SCOUT_HUB_USER
71+
-e DOCKER_SCOUT_HUB_PASSWORD
72+
-u root
73+
-v /var/run/docker.sock:/var/run/docker.sock
74+
--rm {{if .IsTTY}}-it{{end}}
75+
{{.Ref}} cves {{if $org}}--org {{$org}}{{end}} {{opt "ref"}}
76+
77+
- id: cves:pkgs
78+
desc: List vulnerable packages only and ignore the base image
79+
type: run
80+
env:
81+
- DOCKER_SCOUT_HUB_USER
82+
- DOCKER_SCOUT_HUB_PASSWORD
83+
opts:
84+
- name: org
85+
desc: Your organization (Docker Hub namespace)
86+
no-prompt: true
87+
required: false
88+
- name: ref
89+
desc: The image reference
90+
prompt: Please enter the image reference
91+
required: true
92+
cmd: >
93+
{{$org := opt "org"}}
94+
-e DOCKER_SCOUT_HUB_USER
95+
-e DOCKER_SCOUT_HUB_PASSWORD
96+
-u root
97+
-v /var/run/docker.sock:/var/run/docker.sock
98+
--rm {{if .IsTTY}}-it{{end}}
99+
{{.Ref}} cves
100+
--format only-packages --only-vuln-packages --ignore-base
101+
{{if $org}}--org {{$org}}{{end}} {{opt "ref"}}

0 commit comments

Comments
 (0)