Browse Source

🚧 add code dockerhub

main
tchawou-daniel 6 years ago
parent
commit
6c1d03703a
  1. 28
      .circleci/config.yml
  2. 7
      Dockerfile

28
.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

7
Dockerfile

@ -0,0 +1,7 @@
FROM python:3.8.5
COPY . app/
WORKDIR /app
RUN pip install -r requirements/dev.txt
Loading…
Cancel
Save