From ceb42fed76a6551878f1b5eb9f68a992ec585362 Mon Sep 17 00:00:00 2001 From: Roger Chapman Date: Mon, 11 May 2020 09:51:23 +1000 Subject: [PATCH 1/2] adds support for releasing an offical docker image --- .goreleaser.yml | 17 +++++++++++++++++ .travis.yml | 6 ++++++ Dockerfile | 5 +++++ 3 files changed, 28 insertions(+) create mode 100644 Dockerfile diff --git a/.goreleaser.yml b/.goreleaser.yml index 1f7548b77..e6d7aaaf6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -31,3 +31,20 @@ snapshot: name_template: "{{ .Tag }}-next" changelog: sort: asc +dockers: + - goos: linux + goarch: amd64 + binaries: + - mockery + image_templates: + - 'vektra/mockery:{{ .Tag }}' + - 'vektra/mockery:v{{ .Major }}' + - 'vektra/mockery:v{{ .Major }}.{{ .Minor }}' + - 'vektra/mockery:latest' + build_flag_templates: + - "--pull" + - "--label=org.opencontainers.image.created={{.Date}}" + - "--label=org.opencontainers.image.name={{.ProjectName}}" + - "--label=org.opencontainers.image.revision={{.FullCommit}}" + - "--label=org.opencontainers.image.version={{.Version}}" + - "--label=org.opencontainers.image.source={{.GitURL}}" diff --git a/.travis.yml b/.travis.yml index 857106e42..598a8de59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,12 @@ git: script: - go test -v -cover ./... +services: + - docker + +after_success: + - test -n "$TRAVIS_TAG" && docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" + deploy: - provider: script skip_cleanup: true diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..e8836657d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM scratch + +COPY mockery / + +ENTRYPOINT ["/mockery"] From 3f7cae05e266d254820b0a66ae140acc207bd4d3 Mon Sep 17 00:00:00 2001 From: Roger Chapman Date: Mon, 11 May 2020 10:16:45 +1000 Subject: [PATCH 2/2] use a container that has Go installed --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e8836657d..c14edc142 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM scratch +FROM golang:1.14-alpine COPY mockery /