Skip to content

Commit

Permalink
Use goreleaser binaries when making docker image
Browse files Browse the repository at this point in the history
Build and push to docker hub
  • Loading branch information
marcomorain committed Jun 26, 2018
1 parent 11790ed commit 12179db
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 38 deletions.
42 changes: 7 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,7 @@ workflows:
- test
- coverage
- lint
- deploy_github_release:
requires:
- test
- coverage
- lint
filters:
branches:
only: master
- deploy_docker:
- deploy:
requires:
- test
- coverage
Expand Down Expand Up @@ -76,7 +68,7 @@ jobs:
key: v1-gometalinter-{{ checksum "/go/bin/gometalinter" }}
paths: [/go/bin/*]

deploy_github_release:
deploy:
working_directory: /go/src/github.com/circleci/circleci-cli
docker:
- image: circleci/golang:1.10
Expand All @@ -103,31 +95,11 @@ jobs:
- run:
name: Release
command: goreleaser
- run:
name: Build Docker Image
command: |
docker build -t circlecidx/circleci-cli:0.1.$CIRCLE_BUILD_NUM .
docker push circlecidx/circleci-cli:0.1.$CIRCLE_BUILD_NUM
- save_cache:
key: v2-goreleaser-{{ checksum "~/goreleaser_amd64.deb" }}
paths: [~/goreleaser_amd64.deb]

deploy_docker:
docker:
- image: circleci/command-convenience:0.1.392-2e3ae33
environment:
NAME: circleci-cli
CONTAINER_ORG: circlecidx
DOCKERFILE_PATH: Dockerfile
DOCKER_REGISTRY: dockerhub
working_directory: /go/src/github.com/circleci/circleci-cli
steps:
- setup_docker_engine:
docker_layer_caching: true
- checkout
- run:
name: Build the binary
command: make
- run:
name: Build and push circleci-cli image
command: publish
- run:
name: Update the "latest" tag
command: publish
environment:
CONTAINER_VERSION: latest
6 changes: 4 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
project_name: circleci-cli

archive:
format_overrides:
- goos: windows
format: zip

builds:
- binary: circleci-beta
- binary: circleci
goos:
- windows
- darwin
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM circleci/golang:1.10.3

COPY build/linux/amd64/circleci-cli /usr/local/bin/
COPY ~/workspace/dist/linux_amd64/circleci /usr/local/bin

0 comments on commit 12179db

Please sign in to comment.