Skip to content

Commit

Permalink
Native goreleaser (#482)
Browse files Browse the repository at this point in the history
* WIP: use native goreleaser instead of docker version

* Add goreleaser to bundle

* use buildx

* Goreleaser config

* Fix config

* Fix docker build
  • Loading branch information
markphelps authored Jun 15, 2021
1 parent bafc369 commit b695216
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 27 deletions.
14 changes: 9 additions & 5 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ builds:
- main: ./cmd/flipt/.
env:
- CGO_ENABLED=1
- CC=x86_64-linux-musl-gcc
- CXX=x86_64-linux-musl-g++
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
- -linkmode external -extldflags -static
goos:
- linux
goarch:
Expand All @@ -15,7 +20,7 @@ archives:
- LICENSE
- README.md
- CHANGELOG.md
- ./config/migrations/*/**
- ./config/migrations/
- ./config/default.yml

checksum:
Expand All @@ -26,9 +31,7 @@ changelog:

dockers:
- dockerfile: ./build/Dockerfile
binaries:
- flipt
skip_push: true
use_buildx: true
image_templates:
- "markphelps/flipt:latest"
- "markphelps/flipt:{{ .Tag }}"
Expand All @@ -39,4 +42,5 @@ dockers:
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- config
- config/migrations/
- config/default.yml
12 changes: 7 additions & 5 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
brew "go"
brew "cmake"
brew "pkg-config"
brew "sqlite"
brew "protobuf"
brew 'go'
brew 'cmake'
brew 'pkg-config'
brew 'sqlite'
brew 'protobuf'
brew 'FiloSottile/musl-cross/musl-cross'
brew 'goreleaser/tap/goreleaser'
6 changes: 2 additions & 4 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# https://goreleaser.com/docker/

ARG BINARY=flipt
ARG ALPINE_VERSION=3.10.9

FROM alpine:3.10
FROM alpine:${ALPINE_VERSION}
LABEL maintainer="[email protected]"
LABEL org.opencontainers.image.name="flipt"
LABEL org.opencontainers.image.source="https://github.com/markphelps/flipt"
Expand All @@ -21,7 +22,4 @@ COPY config/*.yml /etc/flipt/config/
EXPOSE 8080
EXPOSE 9000

# Docker exposes container ports to the IP address 0.0.0.0
ENV FLIPT_SERVER_HOST 0.0.0.0

CMD ["./flipt"]
15 changes: 2 additions & 13 deletions script/build
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,19 @@

set -euo pipefail

GORELEASER_VERSION=v0.148.0

cd "$(dirname "$0")/.." || exit

case "$1" in
"release")
github-release-notes -org markphelps -repo flipt --since-latest-release | tee release.out

docker run --rm --privileged \
-v "$PWD":/flipt \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /flipt \
-e GITHUB_TOKEN \
goreleaser/goreleaser:"$GORELEASER_VERSION"-cgo --rm-dist --release-notes release.out
goreleaser --rm-dist --release-notes release.out

rm release.out
;;

"snapshot")
docker run --rm --privileged \
-v "$PWD":/flipt \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /flipt \
goreleaser/goreleaser:"$GORELEASER_VERSION"-cgo --rm-dist --snapshot
goreleaser --rm-dist --snapshot
;;

"clients")
Expand Down

0 comments on commit b695216

Please sign in to comment.