From c0f2d40eaa56cee43ad4c43aa98f6974b6e5c9f6 Mon Sep 17 00:00:00 2001 From: doniacld Date: Fri, 15 Oct 2021 08:36:14 +0200 Subject: [PATCH] Add Docker image in release (#489) (#590) --- .gitignore | 1 + .goreleaser.yml | 12 ++++++++++++ Dockerfile | 3 +++ README.md | 12 ++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 Dockerfile diff --git a/.gitignore b/.gitignore index 9b8cdca..b11181c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ golinter revive vendor *.swp +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml index ccd80bf..a17274e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -22,6 +22,18 @@ builds: - darwin - windows +dockers: +- image_templates: ["ghcr.io/mgechev/revive:{{ .Version }}"] + dockerfile: Dockerfile + build_flag_templates: + - --label=org.opencontainers.image.title={{ .ProjectName }} + - --label=org.opencontainers.image.description={{ .ProjectName }} + - --label=org.opencontainers.image.url=https://github.com/mgechev/revive + - --label=org.opencontainers.image.source=https://github.com/mgechev/revive + - --label=org.opencontainers.image.version={{ .Version }} + - --label=org.opencontainers.image.revision={{ .FullCommit }} + - --label=org.opencontainers.image.licenses=MIT + changelog: filters: exclude: diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ebe3eca --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM scratch +COPY revive /usr/bin/revive +ENTRYPOINT ["/usr/bin/revive"] diff --git a/README.md b/README.md index 910d037..86702bb 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,18 @@ Since the default behavior of `revive` is compatible with `golint`, without prov `revive` supports a `-config` flag whose value should correspond to a TOML file describing which rules to use for `revive`'s linting. If not provided, `revive` will try to use a global config file (assumed to be located at `$HOME/revive.toml`). Otherwise, if no configuration TOML file is found then `revive` uses a built-in set of default linting rules. +### Docker +A volume needs to be mounted to share the current repository with the container. +Please refer to the [bind mounts Docker documentation](https://docs.docker.com/storage/bind-mounts/) + +```bash +docker run -v "$(pwd)":/var/ ghcr.io/mgechev/revive:v1.1.2-next -config /var//revive.toml -formatter stylish ./var/kidle/... +``` + +- `-v` is for the volume +- `ghcr.io/mgechev/revive:v1.1.2-next ` is the image name and its version corresponding to `revive` command +- The provided flags are the same as the binary usage. + ### Bazel If you want to use revive with Bazel, take a look at the [rules](https://github.com/atlassian/bazel-tools/tree/master/gorevive) that Atlassian maintains.