diff --git a/.circleci/config.yml b/.circleci/config.yml index f00efad..662151c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,6 +77,31 @@ jobs: - run: name: Heroku Deploy command: git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:master + - run: + name: Smoke Test + command: | + HTTPCODE=`curl -s -o /dev/null -w "%{http_code}" https://$HEROKU_APP_NAME.herokuapp.com/api/articles` + if [ "$HTTPCODE" -ne 200 ];then + echo "heroku app not responding, failing deploy" + exit 1 + fi + buildandpush_dockerhub: + environment: + IMAGE_NAME: sipedaniel/backend-finalproject + docker: + - image: circleci/buildpack-deps:stretch + steps: + - checkout + - setup_remote_docker + - run: docker image build --tag $IMAGE_NAME:latest . + - run: + name: Login and Publish to Docker Hub + command: | + echo "etienne20045" | docker login --username sipedaniel --password-stdin + docker tag $IMAGE_NAME:app $IMAGE_NAME:$CIRCLE_BUILD_NUM + docker tag $IMAGE_NAME:app $IMAGE_NAME:latest + docker push $IMAGE_NAME:latest + docker push $IMAGE_NAME:$CIRCLE_BUILD_NUM workflows: version: 2.1 build_circleci: @@ -86,5 +111,8 @@ workflows: requires: - build - back-deploy-heroku: + requires: + - build + - buildandpush_dockerhub: requires: - build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c879f28 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.8.5 + +COPY . app/ + +WORKDIR /app + +RUN pip install -r requirements/dev.txt \ No newline at end of file