Skip to content

Commit

Permalink
chore(ci): build docker images with goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
graillus committed Jul 26, 2022
1 parent 5cc00df commit 7a64bf5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
28 changes: 27 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
env:
- GO111MODULE=on
- CGO_ENABLED=0
builds:
- main: cmd/gcrgc/gcrgc.go
goos:
Expand All @@ -11,6 +11,32 @@ builds:
- amd64
- arm
- arm64
dockers:
-
goarch: amd64
image_templates:
- "graillus/gcrgc:{{ .Version }}-amd64"
dockerfile: 'Dockerfile.goreleaser'
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.url=https://github.com/graillus/gcrgc"
- "--label=org.opencontainers.image.source=https://github.com/graillus/gcrgc"
- "--label=org.opencontainers.image.description=A garbage collector tool for container registries"
- "--label=org.opencontainers.image.created={{ .Date }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.licenses=MIT"
docker_manifests:
- name_template: graillus/gcrgc:{{ .Version }}
image_templates:
- graillus/gcrgc:{{ .Version }}-amd64
- name_template: graillus/gcrgc:latest
image_templates:
- graillus/gcrgc:{{ .Version }}-amd64

release:
prerelease: auto
changelog:
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ RUN go build -o bin/gcrgc cmd/gcrgc/gcrgc.go

FROM alpine

COPY --from=build /go/src/github.com/graillus/gcrgc/bin/gcrgc /usr/local/bin/gcrgc
COPY --from=build /go/src/github.com/graillus/gcrgc/bin/gcrgc /usr/bin/gcrgc

ENTRYPOINT ["/usr/bin/gcrgc"]
5 changes: 5 additions & 0 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine

COPY gcrgc /usr/bin/gcrgc

ENTRYPOINT ["/usr/bin/gcrgc"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ You can use a service account as well by setting the `GOOGLE_APPLICATION_CREDENT
1. Download your [desired version](https://github.com/graillus/gcrgc/releases)
2. Extract it
```bash
tar xvf gcrgc_0.4.0_linux_amd64.tar.gz
tar xvf gcrgc_0.4.4_linux_amd64.tar.gz
```
3. Move binary to desired destination
```bash
Expand Down

0 comments on commit 7a64bf5

Please sign in to comment.