Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Turn it on 🚀 (fix build, update ci) #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 43 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,53 @@
orbs:
slack: circleci/slack@3.4.2

version: 2

base: &base
machine:
docker_layer_caching: true
working_directory: ~/codeclimate/codeclimate-phpmd



jobs:
build:
machine:
enabled: true
image: circleci/classic:201709-01
environment:
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
PRIVATE_REGISTRY: us.gcr.io/code_climate
IMAGE_NAME: ${PRIVATE_REGISTRY}/${CIRCLE_PROJECT_REPONAME}:b${CIRCLE_BUILD_NUM}
<<: *base
steps:
- checkout
- run: make image

test:
<<: *base
steps:
- checkout
- run: make test

release:
<<: *base
steps:
- checkout
- run: make image
- run: echo "$GCR_JSON_KEY" | docker login -u _json_key --password-stdin us.gcr.io
- run:
name: Prebuild images
command: make test-image
- run:
name: Tests
command: make test
- deploy:
name: Deployment
name: Push image to GCR
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
echo ${GCLOUD_JSON_KEY_BASE64} | sed 's/ //g' | base64 -d > /tmp/gcloud_key.json
curl https://sdk.cloud.google.com | bash
gcloud auth activate-service-account ${gcloud_account_email} --key-file /tmp/gcloud_key.json
gcloud docker -a
docker push ${IMAGE_NAME}
fi
docker tag $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \
us.gcr.io/code-climate/codeclimate-phpmd:b$CIRCLE_BUILD_NUM
docker push us.gcr.io/code-climate/codeclimate-phpmd:b$CIRCLE_BUILD_NUM

workflows:
version: 2
build_release:
jobs:
- build
- test:
requires:
- build
- release:
requires:
- test


notify:
webhooks:
Expand Down
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@ RUN apk add --no-cache \
php7-tokenizer \
php7-xmlwriter \
php7-xml && \
ln -sf /usr/bin/php7 /usr/bin/php && \
apk add --no-cache curl && \
curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer && \
apk del --purge curl && \
rm -r ~/.composer
ln -sf /usr/bin/php7 /usr/bin/php

# Bring composer
COPY --from=composer /usr/bin/composer /usr/local/bin/composer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL: If I got this right, it is going to copy /usr/bin/composer from the composer base image (in DockerHub I guess) into /usr/local/bin/composer, is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, pretty cool right ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed



# Install Dependencies
COPY composer.* ./
Expand All @@ -38,13 +37,13 @@ RUN composer install --no-dev && \

# Build Content
COPY bin/build-content ./bin/build-content
RUN apk add --no-cache ruby ruby-json&& \
gem install httparty --no-rdoc --no-ri && \
RUN apk add --no-cache ruby ruby-json ruby-bigdecimal && \
gem install rdoc httparty --no-document && \
./bin/build-content && \
chown -R app:app content && \
gem uninstall httparty && \
gem uninstall rdoc httparty && \
rm -rf $( gem environment gemdir ) && \
apk del --purge ruby ruby-json && \
apk del --purge ruby ruby-json ruby-bigdecimal && \
rm -r /var/cache/* ~/.gem

COPY . ./
Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ composer-update:
$(IMAGE_NAME) \
sh -c 'cd /usr/src/app && composer update'

citest: test

test:
@$(MAKE) test-image > /dev/null
docker run \
Expand Down
Loading