Skip to content

QUA-958: Push images to Dockerhub instead of GCR #59

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 5 commits into from
Mar 10, 2023
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
13 changes: 8 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ jobs:
steps:
- checkout
- run: make image
- run: echo "$GCR_JSON_KEY" | docker login -u _json_key --password-stdin us.gcr.io
- run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- run:
name: Push image to GCR
name: Push image to Dockerhub
command: |
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
make release RELEASE_TAG="b$CIRCLE_BUILD_NUM"
make release RELEASE_TAG="$(echo $CIRCLE_BRANCH | grep -oP 'channel/\K[\w\-]+')"

workflows:
version: 2
Expand All @@ -42,8 +41,12 @@ workflows:
requires:
- build
- release_images:
context: Quality
requires:
- test
filters:
branches:
only: /master|channel\/[\w-]+/


notify:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:edge
FROM alpine:3.15.0
LABEL maintainer="Code Climate <[email protected]>"

WORKDIR /usr/src/app
Expand Down Expand Up @@ -37,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 ruby-bigdecimal ruby-dev build-base libxml2-dev libxslt-dev libffi-dev && \
RUN apk add --no-cache ruby ruby-json ruby-bigdecimal ruby-dev build-base libxml2-dev libxslt-dev libffi-dev yaml-dev && \

Choose a reason for hiding this comment

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

Hey, it looks good to me, before approving it, do you mind explaining why we need this yaml-dev library please?

Choose a reason for hiding this comment

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

bump

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to install rdoc which is included in a previous step in the Dockerfile, it needs this yaml-dev library to install correctly. If we don't include this library, this error pops up in the installation:

image

this didn't happen before because with the alpine:edge image, we were sitting on version 3.15.0_alpha20210804 instead of version 3.15.0, which might not have that necessary yaml-dev library.

Choose a reason for hiding this comment

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

thanks!

gem install rdoc nokogiri httparty --no-document && \
./bin/build-content && \
chown -R app:app content && \
gem uninstall --all rdoc httparty nokogiri && \
rm -rf $( gem environment gemdir ) && \
apk del --purge ruby ruby-json ruby-bigdecimal ruby-dev build-base libxml2-dev libxslt-dev libffi-dev && \
apk del --purge ruby ruby-json ruby-bigdecimal ruby-dev build-base libxml2-dev libxslt-dev libffi-dev yaml-dev && \
rm -rf /var/cache/* ~/.gem

COPY . ./
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
.PHONY: image composer-update test
.PHONY: image composer-update test release

IMAGE_NAME ?= codeclimate/codeclimate-phpmd
RELEASE_REGISTRY ?= codeclimate

ifndef RELEASE_TAG
override RELEASE_TAG = latest
endif

image:
docker build --tag $(IMAGE_NAME) .
Expand All @@ -26,3 +31,7 @@ test:
--volume $(PWD)/tests:/usr/src/app/tests \
$(IMAGE_NAME)-test \
sh -c "vendor/bin/phpunit --bootstrap engine.php ./tests"

release:
docker tag $(IMAGE_NAME) $(RELEASE_REGISTRY)/codeclimate-phpmd:$(RELEASE_TAG)
docker push $(RELEASE_REGISTRY)/codeclimate-phpmd:$(RELEASE_TAG)