Skip to content

Commit c0f2d40

Browse files
authored
Add Docker image in release (#489) (#590)
1 parent be81121 commit c0f2d40

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ golinter
22
revive
33
vendor
44
*.swp
5+
dist/

.goreleaser.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ builds:
2222
- darwin
2323
- windows
2424

25+
dockers:
26+
- image_templates: ["ghcr.io/mgechev/revive:{{ .Version }}"]
27+
dockerfile: Dockerfile
28+
build_flag_templates:
29+
- --label=org.opencontainers.image.title={{ .ProjectName }}
30+
- --label=org.opencontainers.image.description={{ .ProjectName }}
31+
- --label=org.opencontainers.image.url=https://github.com/mgechev/revive
32+
- --label=org.opencontainers.image.source=https://github.com/mgechev/revive
33+
- --label=org.opencontainers.image.version={{ .Version }}
34+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
35+
- --label=org.opencontainers.image.licenses=MIT
36+
2537
changelog:
2638
filters:
2739
exclude:

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM scratch
2+
COPY revive /usr/bin/revive
3+
ENTRYPOINT ["/usr/bin/revive"]

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ Since the default behavior of `revive` is compatible with `golint`, without prov
119119

120120
`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.
121121

122+
### Docker
123+
A volume needs to be mounted to share the current repository with the container.
124+
Please refer to the [bind mounts Docker documentation](https://docs.docker.com/storage/bind-mounts/)
125+
126+
```bash
127+
docker run -v "$(pwd)":/var/<repository> ghcr.io/mgechev/revive:v1.1.2-next -config /var/<repository>/revive.toml -formatter stylish ./var/kidle/...
128+
```
129+
130+
- `-v` is for the volume
131+
- `ghcr.io/mgechev/revive:v1.1.2-next ` is the image name and its version corresponding to `revive` command
132+
- The provided flags are the same as the binary usage.
133+
122134
### Bazel
123135

124136
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.

0 commit comments

Comments
 (0)