Skip to content

Commit

Permalink
ci: Build and publish container image
Browse files Browse the repository at this point in the history
* Builds container images using goreleaser docker

* Images built are :latest and :tag

* Images are pusblished to docker.io

* Build is triggered when a tag is pushed
  • Loading branch information
George Gkioulis committed Oct 17, 2020
1 parent fb834e9 commit d319fbe
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/gorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
uses: actions/checkout@v2.3.3
with:
fetch-depth: 0

- name: Login to Docker Registry
run: |
echo "${{ secrets.DOCKERHUB_SECRET }}" | \
docker login -u romie --password-stdin
- name: Set up Go
uses: actions/setup-go@v2.1.3
with:
Expand Down
35 changes: 35 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,38 @@ builds:
mod_timestamp: "{{ .CommitTimestamp }}"
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{ .CommitDate }} -X main.builtBy=goreleaser

dockers:
# You can have multiple Docker images.
-
# GOOS of the built binary that should be used.
goos: linux

# GOARCH of the built binary that should be used.
goarch: amd64

# Name templates of the built binaries that should be used.
binaries:
- romie

# Templates of the Docker image names.
image_templates:
- "romie/romie:latest"
- "romie/romie:{{ .Tag }}"

# Skips the docker push. Could be useful if you also do draft releases.
# If set to auto, the release will not be pushed to the docker repository
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1
# Defaults to false.
skip_push: false

# Path to the Dockerfile (from the project root).
dockerfile: Dockerfile

# Template of the docker build flags.
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM scratch
COPY romie /
ENTRYPOINT ["/romie"]

0 comments on commit d319fbe

Please sign in to comment.