From 61b17b2e4d105a7b1f2eb39bd2bd2f39b7f636e0 Mon Sep 17 00:00:00 2001 From: Will Fleming Date: Tue, 16 Feb 2016 16:59:00 -0500 Subject: [PATCH 1/4] Add a Makefile pretty standard for our engines by now. --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..56c3da0b --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +.PHONY: image test + +IMAGE_NAME ?= codeclimate/codeclimate-rubocop + +image: + docker build --rm -t $(IMAGE_NAME) . + +test: image + docker run --rm $(IMAGE_NAME) sh -c "cd /usr/src/app && bundle exec rake" From 81b349106551a758493afa0a6e1558e88ef9747b Mon Sep 17 00:00:00 2001 From: Will Fleming Date: Tue, 16 Feb 2016 16:59:18 -0500 Subject: [PATCH 2/4] CircleCI: use the Makefile --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index dbaf35a3..d7d59697 100644 --- a/circle.yml +++ b/circle.yml @@ -10,11 +10,11 @@ machine: dependencies: override: - - docker build -t=$PRIVATE_REGISTRY/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM . + - echo "no-op" test: override: - - docker run $PRIVATE_REGISTRY/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM bundle exec rake + - IMAGE_NAME="$PRIVATE_REGISTRY/$CIRCLE_PROJECT_REPONAME:b$CIRCLE_BUILD_NUM" make test deployment: registry: From 2a80509c799d58d62129b5214482795db2d7cd1a Mon Sep 17 00:00:00 2001 From: Will Fleming Date: Tue, 16 Feb 2016 16:59:53 -0500 Subject: [PATCH 3/4] add .dockerignore --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..89660678 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.bundle +.git From 70e4fd5267121c128a6450ab594672fce7a581b5 Mon Sep 17 00:00:00 2001 From: Will Fleming Date: Tue, 16 Feb 2016 17:00:04 -0500 Subject: [PATCH 4/4] Dockerfile: set WORKDIR to /code This is best practice for engines now. --- Dockerfile | 3 +++ bin/codeclimate-rubocop | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8e2ee969..c86ebefa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,4 +17,7 @@ USER app RUN cd /usr/src/app && \ rake docs:scrape +VOLUME /code +WORKDIR /code + CMD ["/usr/src/app/bin/codeclimate-rubocop"] diff --git a/bin/codeclimate-rubocop b/bin/codeclimate-rubocop index 62d6b97f..7dc9723f 100755 --- a/bin/codeclimate-rubocop +++ b/bin/codeclimate-rubocop @@ -11,4 +11,4 @@ else engine_config = {} end -CC::Engine::Rubocop.new("/code", engine_config, STDOUT).run +CC::Engine::Rubocop.new(Dir.pwd, engine_config, STDOUT).run