Skip to content

Commit d70508f

Browse files
authored
Push images to Dockerhub instead of GCR (#344)
1 parent d174500 commit d70508f

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

.circleci/config.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,25 @@ jobs:
2525
circleci step halt
2626
fi
2727
- run: make image
28-
- run: echo "$GCR_JSON_KEY" | docker login -u _json_key --password-stdin us.gcr.io
28+
- run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
2929
- run:
30-
name: Push image to GCR
30+
name: Push image to Dockerhub
3131
command: |
32-
docker tag $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \
33-
us.gcr.io/code-climate/codeclimate-rubocop:b$CIRCLE_BUILD_NUM
34-
docker push us.gcr.io/code-climate/codeclimate-rubocop:b$CIRCLE_BUILD_NUM
32+
make release RELEASE_TAG="b$CIRCLE_BUILD_NUM"
33+
make release RELEASE_TAG="$(echo $CIRCLE_BRANCH | grep -oP 'channel/\K[\w\-]+')"
3534
3635
workflows:
3736
version: 2
3837
build_deploy:
3938
jobs:
4039
- test
4140
- release_images:
41+
context: Quality
4242
requires:
4343
- test
4444
filters:
4545
branches:
4646
only: /master|channel\/[\w-]+/
4747
notify:
4848
webhooks:
49-
- url: https://cc-slack-proxy.herokuapp.com/circle
49+
- url: https://cc-slack-proxy.herokuapp.com/circle

Makefile

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
.PHONY: image test docs bundle
1+
.PHONY: image test docs bundle release
22

33
IMAGE_NAME ?= codeclimate/codeclimate-rubocop
4+
RELEASE_REGISTRY ?= codeclimate
5+
6+
ifndef RELEASE_TAG
7+
override RELEASE_TAG = latest
8+
endif
49

510
image:
611
docker build --rm -t $(IMAGE_NAME) .
@@ -19,4 +24,8 @@ bundle:
1924
docker run --rm \
2025
--entrypoint /bin/sh \
2126
--volume $(PWD):/usr/src/app \
22-
$(IMAGE_NAME) -c "cd /usr/src/app && bundle $(BUNDLE_ARGS)"
27+
$(IMAGE_NAME) -c "cd /usr/src/app && bundle $(BUNDLE_ARGS)"
28+
29+
release:
30+
docker tag $(IMAGE_NAME) $(RELEASE_REGISTRY)/codeclimate-rubocop:$(RELEASE_TAG)
31+
docker push $(RELEASE_REGISTRY)/codeclimate-rubocop:$(RELEASE_TAG)

0 commit comments

Comments
 (0)