Skip to content

Commit

Permalink
GoReleaser: add Docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
talal committed Aug 14, 2020
1 parent 036ae02 commit dcc07e2
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ jobs:
with:
go-version: 1.14

- name: Docker Login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }}
run: |
echo "${DOCKER_ACCESS_TOKEN}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Generate release info
run: make build/release-info

Expand All @@ -33,3 +40,8 @@ jobs:
args: release --rm-dist --release-notes=./build/release-info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cleanup
if: always()
run: rm -f ${HOME}/.docker/config.json

16 changes: 16 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ builds:
archives:
- name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}"

dockers:
- image_templates:
- "sapcc/absent-metrics-operator:{{ .Tag }}"
- "sapcc/absent-metrics-operator:v{{ .Major }}.{{ .Minor }}"
- "sapcc/absent-metrics-operator:latest"
dockerfile: Dockerfile.goreleaser
binaries:
- absent-metrics-operator
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.version={{.Version}}"

checksum:
name_template: "checksums.txt"

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2020-08-13
### Added
- Initial release.

[Unreleased]: https://github.com/sapcc/absent-metrics-operator/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/sapcc/absent-metrics-operator/releases/tag/v0.1.0
10 changes: 10 additions & 0 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# We use this additional file instead of the other Dockerfile because
# GoReleaser already compiles a static binary and we can just copy it over
# compared to the other Dockerfile which first compiles it.
#
# This saves extra work and time in our CI release workflow.
FROM alpine:latest

RUN apk add --no-cache ca-certificates
COPY absent-metrics-operator /usr/bin/
ENTRYPOINT [ "/usr/bin/absent-metrics-operator" ]
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Absent Metrics Operator

[![GitHub Release](https://img.shields.io/github/v/release/sapcc/absent-metrics-operator)](https://github.com/sapcc/absent-metrics-operator/releases/latest)
![Build and Test](https://github.com/sapcc/absent-metrics-operator/workflows/Build%20and%20Test/badge.svg)
[![Coverage Status](https://coveralls.io/repos/github/sapcc/absent-metrics-operator/badge.svg)](https://coveralls.io/github/sapcc/absent-metrics-operator)
[![Coverage Status](https://coveralls.io/repos/github/sapcc/absent-metrics-operator/badge.svg?branch=master)](https://coveralls.io/github/sapcc/absent-metrics-operator?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/sapcc/absent-metrics-operator)](https://goreportcard.com/report/github.com/sapcc/absent-metrics-operator)

> Project status: **alpha**. The API and user facing objects may change.
Expand Down Expand Up @@ -66,6 +67,11 @@ annotations:

## Installation

### Pre-compiled binaries

Pre-compiled binaries for Linux are available on the [releases
page](https://github.com/sapcc/absent-metrics-operator/releases/latest).

### Building from source

The only required build dependency is [Go](https://golang.org/).
Expand Down

0 comments on commit dcc07e2

Please sign in to comment.