Skip to content

Commit

Permalink
Configure goreleaser to handle docker publish
Browse files Browse the repository at this point in the history
  • Loading branch information
z4kn4fein committed Apr 13, 2024
1 parent 39c1f26 commit 441f4ae
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 124 deletions.
52 changes: 3 additions & 49 deletions .github/workflows/proxy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,54 +37,6 @@ jobs:
- name: Test with race
run: go test -race ./...

release-docker-version-tag:
runs-on: ubuntu-latest
needs: [ test ]

steps:
- uses: actions/checkout@v4

- name: Get version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
configcat/proxy:${{ env.VERSION }}
release-docker-latest-tag:
runs-on: ubuntu-latest
needs: [ test ]
if: endsWith(github.event.base_ref, 'main') == true
steps:
- uses: actions/checkout@v4

- name: Get version from tag
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
configcat/proxy:latest
release-goreleaser:
runs-on: ubuntu-latest
needs: [ test ]
Expand All @@ -102,4 +54,6 @@ jobs:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
25 changes: 24 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,37 @@ builds:
- env:
- CGO_ENABLED=0
ldflags:
- -s -w -X internal.version.Version={{.Version}}
- -s -w -X github.com/configcat/configcat-proxy/sdk.proxyVersion={{.Version}}
goos:
- linux
- windows
- darwin
goarch:
- '386'
- amd64
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
goarm:
- '7'

archives:
- format: tar.gz
format_overrides:
- goos: windows
format: zip

dockers:
- image_templates:
- "configcat/proxy:{{.Version}}"
- "configcat/proxy:v{{.Major}}"
- "configcat/proxy:latest"
goos: linux
goarch: amd64
dockerfile: Dockerfile.goreleaser
skip_push: false
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
8 changes: 8 additions & 0 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM gcr.io/distroless/static-debian11

COPY --chown=nonroot:nonroot /configcat-proxy /

USER nonroot
EXPOSE 8050 8051 50051

ENTRYPOINT ["/configcat-proxy"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The docker image is available on DockerHub. You can run the image either as a st

1. Pull the docker image:
```shell
docker pull configcat/proxy:1.0.0
docker pull configcat/proxy
```
2. Run the ConfigCat Proxy:
```shell
Expand All @@ -63,7 +63,7 @@ Using with `docker-compose`:
```yaml
services:
configcat_proxy:
image: configcat/proxy:1.0.0
image: configcat/proxy
environment:
- CONFIGCAT_SDKS={"<sdk-identifier>":"<your-sdk-key>"}
ports:
Expand Down
39 changes: 19 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,40 @@ go 1.21

require (
github.com/alicebob/miniredis/v2 v2.32.1
github.com/aws/aws-sdk-go-v2 v1.26.0
github.com/aws/aws-sdk-go-v2/config v1.27.9
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.0
github.com/cespare/xxhash/v2 v2.2.0
github.com/configcat/go-sdk/v9 v9.0.3
github.com/aws/aws-sdk-go-v2 v1.26.1
github.com/aws/aws-sdk-go-v2/config v1.27.11
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.31.1
github.com/cespare/xxhash/v2 v2.3.0
github.com/configcat/go-sdk/v9 v9.0.6
github.com/fsnotify/fsnotify v1.7.0
github.com/julienschmidt/httprouter v1.3.0
github.com/prometheus/client_golang v1.19.0
github.com/redis/go-redis/v9 v9.5.1
github.com/stretchr/testify v1.9.0
go.mongodb.org/mongo-driver v1.14.0
google.golang.org/grpc v1.62.1
go.mongodb.org/mongo-driver v1.15.0
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.9 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.4 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.5 // indirect
github.com/aws/smithy-go v1.20.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.9.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.5 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.6 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.13.6 // indirect
Expand All @@ -57,5 +56,5 @@ require (
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect
)
Loading

0 comments on commit 441f4ae

Please sign in to comment.