Skip to content

Commit

Permalink
feat: build with goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
thefirstofthe300 committed May 12, 2022
1 parent 70ff030 commit 44c13e5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
47 changes: 35 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
version: 2.1
orbs:
gor: hubci/goreleaser@2.1.0
gor: ory/goreleaser@0.1.38
workflows:
main-wf:
test:
jobs:
- cache
- docker_setup:
context:
- docker-hub-login
- gor/release:
version: 1.7.0
go-version: '1.18'
dry-run: true
release-wf:
- install_goreleaser
- test
release:
jobs:
- cache:
filters:
Expand All @@ -28,9 +26,13 @@ workflows:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- gor/release:
version: 1.7.0
go-version: '1.18'
- install_goreleaser:
filters:
branches:
ignore: /.*/
tags:
only: /^v\d+\.\d+\.\d+$/
- release:
filters:
branches:
ignore: /.*/
Expand All @@ -49,14 +51,35 @@ jobs:
- go-mod-v1
- run:
name: Download Dependancies
command: go mod tidy
command: go mod download
- save_cache:
key: go-mod-v1-{{ checksum "go.mod" }}-{{ checksum "go.sum" }}
paths:
- /go/pkg/mod
- ~/go/pkg/mod
docker_setup:
machine:
image: ubuntu-2004:current
steps:
- run: |
docker login -u "${CONTEXT_GREMLIN_DOCKER_USERNAME}" -p "${CONTEXT_GREMLIN_DOCKER_PASSWORD}"
install_goreleaser:
docker:
- image: 'cimg/go:1.18'
steps:
- run: |
dlURL="https://github.com/goreleaser/goreleaser/releases/download/v1.7.0/goreleaser_Linux_x86_64.tar.gz"
curl -sSL $dlURL | $SUDO tar -xz -C ~/bin goreleaser
test:
docker:
- image: 'cimg/go:1.18'
steps:
- run: |
goreleaser release --snapshot --skip-publish --rm-dist
release:
docker:
- image: 'cimg/go:1.18'
steps:
- run: |
goreleaser release
docker build -f Dockerfile.goreleaser gremlin/aws-encryption-provider:${CIRCLE_TAG} .
docker push gremlin/aws-encryption-provider:${CIRCLE_TAG}
7 changes: 0 additions & 7 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ builds:
- CGO_ENABLED=0
goos:
- linux
dockers:
- image_templates:
- gremlin/aws-encryption-provider
- gremlin/aws-encryption-provider:{{ .Tag }}
ids:
- aws-encryption-provider
dockerfile: Dockerfile.goreleaser
checksum:
name_template: 'checksums.txt'
changelog:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.goreleaser
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.13-alpine AS build
FROM golang:1.18-alpine AS build
RUN apk --no-cache update && \
apk --no-cache add ca-certificates && \
rm -rf /var/cache/apk/*

FROM busybox AS aws-encryption-provider
COPY --from=build /etc/ssl/certs/ /etc/ssl/certs/
COPY aws-encryption-provider /aws-encryption-provider
COPY dist/aws-encryption-provider_linux_arm64/aws-encryption-provider /aws-encryption-provider
ENTRYPOINT ["/aws-encryption-provider"]

0 comments on commit 44c13e5

Please sign in to comment.