diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e2ecc56 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,37 @@ +name: deploy + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Publish to Github Packages Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: aakashlpin/excalibur/excalibur + registry: docker.pkg.github.com + username: ${{ secrets.GITBUH_USERNAME }} + password: ${{ secrets.GITHUB_TOKEN }} + dockerfile: Dockerfile + tags: latest + - name: Deploy package to digitalocean + uses: appleboy/ssh-action@master + env: + GITBUH_USERNAME: ${{ secrets.GITBUH_USERNAME }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + host: ${{ secrets.DO_HOST }} + username: ${{ secrets.DO_USERNAME }} + key: ${{ secrets.SSH_ID_RSA }} + envs: GITBUH_USERNAME, GITHUB_TOKEN + script: | + docker login docker.pkg.github.com -u $GITBUH_USERNAME -p $GITHUB_TOKEN + docker pull docker.pkg.github.com/aakashlpin/excalibur/excalibur:latest + docker stop excalibur + docker run -dit --rm -p 5000:5000 --name excalibur docker.pkg.github.com/aakashlpin/excalibur/excalibur:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4f8f897 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:bionic +WORKDIR /home/root +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y git libsm6 libxext6 libxrender1 libfontconfig1 python3 python3-pip python-pip python3-tk ghostscript && gs -version +COPY . ./excalibur +#&& perl -pi -e 's/from werkzeug import secure_filename/from werkzeug.utils import secure_filename/' excalibur/www/views.py \ +RUN cd excalibur \ + && ls -lah \ + && pip3 install . \ + && cd ../ +ENV LC_ALL=C.UTF-8 +ENV LANG=C.UTF-8 +EXPOSE 5000 +ENTRYPOINT [ "python3", "./excalibur/arthur.py" ] \ No newline at end of file diff --git a/excalibur/config_templates/default_excalibur.cfg b/excalibur/config_templates/default_excalibur.cfg index fd3dc67..2c7ef05 100644 --- a/excalibur/config_templates/default_excalibur.cfg +++ b/excalibur/config_templates/default_excalibur.cfg @@ -15,7 +15,7 @@ logging_level = INFO [webserver] # The host interface on which to listen. # 127.0.0.1 means the web server will only respond to requests from the local machine. -web_server_host = 127.0.0.1 +web_server_host = 0.0.0.0 # The port on which to run the web server. web_server_port = 5000 diff --git a/setup.py b/setup.py index a618161..1508503 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ readme = f.read() requires = [ + "opencv-python==4.2.0.34", "camelot-py[cv]>=0.7.1", "celery>=4.1.1", "Click>=7.0",