Skip to content

Commit

Permalink
Merge pull request #9 from Kalkuli/develop
Browse files Browse the repository at this point in the history
Config Deploy
  • Loading branch information
MarianaPicolo authored Oct 2, 2018
2 parents 628b109 + 9d878a9 commit 6f9688d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ before_script:
script:
- docker-compose -f docker-compose-dev.yml run base python3.6 manage.py test
after_script:
- docker-compose -f docker-compose-dev.yml down
- docker-compose -f docker-compose-dev.yml down
after_success:
- chmod +x ./deploy.sh
- ./deploy.sh
26 changes: 26 additions & 0 deletions Dockerfile-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Our base image already includes tesseract. This should be the case only for
# this service.
FROM tesseractshadow/tesseract4re

RUN mkdir /usr/src/app
WORKDIR /usr/src/app

# Making sure we are using Python 3.6
RUN add-apt-repository ppa:jonathonf/python-3.6
RUN apt-get update
RUN apt-get install -y poppler-utils
RUN apt-get install -y python3.6 libpython3.6

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
RUN rm /usr/bin/python3
RUN ln -s python3.6 /usr/bin/python3

RUN apt-get install -y python3-pip

COPY ./requirements.txt /usr/src/app/requirements.txt
RUN pip3 install -r requirements.txt

COPY . /usr/src/app

CMD gunicorn -b 0.0.0.0:$PORT manage:app
18 changes: 18 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

set -e
set -u

if [ $TRAVIS_PULL_REQUEST != "false" -o $TRAVIS_BRANCH != "master" ]
then
echo "Skipping deployment on branch=$TRAVIS_BRANCH, PR=$TRAVIS_PULL_REQUEST"
exit 0;
fi

docker login -u _ -p "$HEROKU_TOKEN" registry.heroku.com

docker build -t registry.heroku.com/kalkuli-extraction/web -f Dockerfile-prod .

docker push registry.heroku.com/kalkuli-extraction/web

heroku container:release web -a kalkuli-extraction
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ Pillow
pytesseract
opencv-python
Flask-Testing==0.6.2
coverage==4.5.1
coverage==4.5.1
gunicorn==19.8.1

0 comments on commit 6f9688d

Please sign in to comment.