Skip to content

Commit 794d0ab

Browse files
committed
add github actions + goreleaser dockers
1 parent f949b56 commit 794d0ab

File tree

6 files changed

+97
-20
lines changed

6 files changed

+97
-20
lines changed

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
-
16+
name: Checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
21+
-
22+
name: Set up Go
23+
uses: actions/setup-go@v2
24+
with:
25+
go-version: 1.17
26+
27+
-
28+
name: Docker login
29+
run: |
30+
docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD}
31+
env:
32+
DOCKER_USERNAME: ${{ secrets.docker_username }}
33+
DOCKER_PASSWORD: ${{ secrets.docker_password }}
34+
35+
-
36+
name: Run GoReleaser
37+
uses: goreleaser/goreleaser-action@v2
38+
with:
39+
distribution: goreleaser
40+
version: latest
41+
args: release --rm-dist --debug
42+
env:
43+
BUILD_TAG: "latest"
44+
GOPATH: ${{ env.GOPATH }}
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
/chproxy
44
/tags
5+
/dist
56

67
# Documentation dependencies and artefacts
78
/docs/dist

.goreleaser.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
builds:
3+
- binary: chproxy
4+
goos:
5+
- linux
6+
goarch:
7+
- amd64
8+
flags:
9+
- "-tags={{ .Env.BUILD_TAG }}"
10+
ldflags:
11+
- -s
12+
- -w
13+
- -X main.buildTime={{ .Date }}
14+
- -X main.buildRevision={{ .FullCommit }}
15+
- -X main.buildTag={{ .Version }}
16+
gcflags:
17+
- -trimpath={{.Env.GOPATH}}/src
18+
19+
dockers:
20+
- goos: linux
21+
goarch: amd64
22+
image_templates:
23+
- "contentsquareplatform/chproxy:{{ .Version }}"
24+
25+
snapshot:
26+
name_template: "{{ .FullCommit }}-SNAPSHOT"
27+
28+
release:
29+
# Repo in which the release will be created.
30+
# Default is extracted from the origin remote URL.
31+
github:
32+
owner: ContentSquare
33+
name: chproxy
34+
35+
# If set to true, will not auto-publish the release.
36+
# Default is false.
37+
draft: false

Dockerfile

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
FROM golang:1.16-alpine AS build
2-
3-
RUN apk add --update zstd-static zstd-dev make gcc musl-dev git
4-
RUN go get golang.org/x/lint/golint
5-
RUN mkdir -p /go/src/github.com/Vertamedia/chproxy
6-
WORKDIR /go/src/github.com/Vertamedia/chproxy
7-
COPY . ./
8-
ARG EXT_BUILD_TAG
9-
ENV EXT_BUILD_TAG ${EXT_BUILD_TAG}
10-
RUN make release-build
11-
12-
FROM alpine
13-
COPY --from=build /go/src/github.com/Vertamedia/chproxy/chproxy /chproxy
14-
ENTRYPOINT [ "/chproxy" ]
15-
CMD [ "--help" ]
1+
FROM golang:1.17-alpine AS builder
2+
3+
RUN apk update && apk add --no-cache git ca-certificates && update-ca-certificates
4+
5+
FROM scratch
6+
7+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
8+
9+
COPY chproxy /
10+
11+
ENTRYPOINT ["/chproxy"]

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/contentsquare/chproxy
33
go 1.13
44

55
require (
6-
github.com/DataDog/zstd v1.4.4
6+
github.com/DataDog/zstd v1.5.0
77
github.com/alicebob/miniredis/v2 v2.16.0
88
github.com/frankban/quicktest v1.7.2 // indirect
99
github.com/go-redis/redis/v8 v8.11.4

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/DataDog/zstd v1.4.4 h1:+IawcoXhCBylN7ccwdwf8LOH2jKq7NavGpEPanrlTzE=
2-
github.com/DataDog/zstd v1.4.4/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
1+
github.com/DataDog/zstd v1.5.0 h1:+K/VEwIAaPcHiMtQvpLD4lqW7f0Gk3xdYZmI1hD+CXo=
2+
github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
33
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
44
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
55
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
@@ -12,7 +12,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
1212
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
1313
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
1414
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
15-
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
1615
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
1716
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
1817
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
@@ -45,7 +44,6 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x
4544
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
4645
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
4746
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
48-
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
4947
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
5048
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
5149
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=

0 commit comments

Comments
 (0)