Skip to content

Commit

Permalink
refactor goreleaser configuration (#168)
Browse files Browse the repository at this point in the history
* refactor goreleaser configuration

* ignoring local config.toml
  • Loading branch information
sebbalex authored Jul 21, 2020
1 parent 880135f commit 0fcf55e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ elasticsearch/config/searchguard/sg_internal_users.yml
# Configurations
crawler/config.toml
crawler/domains.yml
# GoReleaser workaround
config.toml

# Downloaded files
crawler/cache
Expand Down
28 changes: 20 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
- cp crawler/config.toml.example ./config.toml
builds:
-
id: crawler
binary: crawlerbin
binary: crawler
dir: crawler
main: ./main.go
ldflags:
- -s -w -X github.com/italia/developers-italia-backend/crawler/version.VERSION={{.Version}}
env:
- CGO_ENABLED=0
hooks:
post: cp crawler/config.toml.example {{ dir .Path }}/config.toml
post: cp config.toml {{ dir .Path }}/config.toml
archives:
- replacements:
darwin: Darwin
-
builds:
- crawler
wrap_in_directory: false
files:
- config.toml
replacements:
darwin: macOS
linux: Linux
windows: Windows
386: i386
amd64: x86_64
386: 32-bit
amd64: 64-bit
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
Expand All @@ -34,13 +46,13 @@ dockers:
goos: linux
goarch: amd64
binaries:
- crawlerbin
- crawler
builds:
- crawler
skip_push: false
dockerfile: Dockerfile.goreleaser
extra_files:
- crawler/config.toml.example
- config.toml
image_templates:
- "italia/developers-italia-backend:latest"
- "italia/developers-italia-backend:{{ .Tag }}"
4 changes: 2 additions & 2 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine

COPY crawlerbin /crawler
COPY crawler/config.toml.example /config.toml
COPY crawler /
COPY config.toml /

# Run the compiled binary.
ENTRYPOINT ["/crawler"]

0 comments on commit 0fcf55e

Please sign in to comment.