Skip to content

Commit

Permalink
Add dockers: setting to .goreleaser.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed Mar 4, 2021
1 parent 8e6b869 commit f83c8e9
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 58 deletions.
129 changes: 72 additions & 57 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,46 @@ before:
- go mod download
- go mod tidy
builds:
-
id: ndiag-darwin
hooks:
pre: packr2
post: packr2 clean
ldflags:
- -s -w -X github.com/k1LoW/ndiag.version={{.Version}} -X github.com/k1LoW/ndiag.commit={{.FullCommit}} -X github.com/k1LoW/ndiag.date={{.Date}} -X github.com/k1LoW/ndiag/version.Version={{.Version}}
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
-
id: ndiag-linux
hooks:
pre: packr2
post: packr2 clean
ldflags:
- -s -w -X github.com/k1LoW/ndiag.version={{.Version}} -X github.com/k1LoW/ndiag.commit={{.FullCommit}} -X github.com/k1LoW/ndiag.date={{.Date}} -X github.com/k1LoW/ndiag/version.Version={{.Version}}
- -linkmode external
- -extldflags '-static'
env:
- CGO_ENABLED=1
- CC=/usr/local/bin/x86_64-linux-musl-cc # brew install FiloSottile/musl-cross/musl-cross
goos:
- linux
goarch:
- amd64
-
id: ndiag-darwin
hooks:
pre: packr2
post: packr2 clean
ldflags:
- -s -w -X github.com/k1LoW/ndiag.version={{.Version}} -X github.com/k1LoW/ndiag.commit={{.FullCommit}} -X github.com/k1LoW/ndiag.date={{.Date}} -X github.com/k1LoW/ndiag/version.Version={{.Version}}
env:
- CGO_ENABLED=1
goos:
- darwin
goarch:
- amd64
-
id: ndiag-linux
hooks:
pre: packr2
post: packr2 clean
ldflags:
- -s -w -X github.com/k1LoW/ndiag.version={{.Version}} -X github.com/k1LoW/ndiag.commit={{.FullCommit}} -X github.com/k1LoW/ndiag.date={{.Date}} -X github.com/k1LoW/ndiag/version.Version={{.Version}}
- -linkmode external
- -extldflags '-static'
env:
- CGO_ENABLED=1
- CC=/usr/local/bin/x86_64-linux-musl-cc # brew install FiloSottile/musl-cross/musl-cross
goos:
- linux
goarch:
- amd64
archives:
-
id: ndiag-archive
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
format_overrides:
- goos: darwin
format: zip
files:
- CREDITS
- README.md
- CHANGELOG.md
-
id: ndiag-archive
name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
format_overrides:
- goos: darwin
format: zip
files:
- CREDITS
- README.md
- CHANGELOG.md
checksum:
name_template: 'checksums.txt'
snapshot:
Expand All @@ -54,30 +54,45 @@ changelog:
exclude:
- '^docs:'
- '^test:'
dockers:
-
goos: linux
goarch: amd64
image_templates:
- 'ghcr.io/k1low/ndiag:v{{ .Version }}'
- 'ghcr.io/k1low/ndiag:latest'
dockerfile: Dockerfile
build_flag_templates:
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- scripts/entrypoint.sh
brews:
-
name: ndiag
tap:
owner: k1LoW
name: homebrew-tap
commit_author:
name: k1LoW
email: [email protected]
homepage: https://github.com/k1LoW/ndiag
description: 'ndiag is a high-level architecture diagramming/documentation tool.'
license: MIT
install: |
system './ndiag', 'completion', 'bash', '--out', 'ndiag.bash'
system './ndiag', 'completion', 'zsh', '--out', 'ndiag.zsh'
bin.install 'ndiag'
bash_completion.install 'ndiag.bash' => 'ndiag'
zsh_completion.install 'ndiag.zsh' => '_ndiag'
-
name: ndiag
tap:
owner: k1LoW
name: homebrew-tap
commit_author:
name: k1LoW
email: [email protected]
homepage: https://github.com/k1LoW/ndiag
description: 'ndiag is a high-level architecture diagramming/documentation tool.'
license: MIT
install: |
system './ndiag', 'completion', 'bash', '--out', 'ndiag.bash'
system './ndiag', 'completion', 'zsh', '--out', 'ndiag.zsh'
bin.install 'ndiag'
bash_completion.install 'ndiag.bash' => 'ndiag'
zsh_completion.install 'ndiag.zsh' => '_ndiag'
nfpms:
-
id: ndiag-nfpms
file_name_template: "{{ .ProjectName }}_{{ .Version }}-1_{{ .Arch }}"
builds:
- ndiag-linux
- ndiag-linux
homepage: https://github.com/k1LoW/ndiag
maintainer: Ken'ichiro Oyama <[email protected]>
description: ndiag is a high-level architecture diagramming/documentation tool.
Expand Down
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM golang:1.16-alpine

RUN apk add --no-cache bash

ENTRYPOINT ["/entrypoint.sh"]
CMD [ "-h" ]

COPY scripts/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

COPY ndiag_*.apk /tmp/
RUN apk add --allow-untrusted /tmp/ndiag_*.apk
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,9 @@ Download binary from [releases page](https://github.com/k1LoW/ndiag/releases)
```console
$ go get github.com/k1LoW/ndiag
```

**docker:**

```console
$ docker pull ghcr.io/k1low/ndiag:latest
```
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ require (
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5
github.com/olekukonko/tablewriter v0.0.4
github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.1.1
github.com/stoewer/go-strcase v1.2.0
)
3 changes: 3 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

ndiag $@

0 comments on commit f83c8e9

Please sign in to comment.