Skip to content

Commit

Permalink
Correct some problems with the docker-compose (#111)
Browse files Browse the repository at this point in the history
* Correct some problems with the docker-compose
Now, a simple docker-compose up starts everything (even a demo UI).

For development, the docker-compose-build.yml can be used

Updated the doc as well

* exclude pull_request events for parsr-base  and parsr-ui pipelines

* trying to build API on pull_request event

* fix permission issue
  • Loading branch information
slallemand authored and Aarohi Johal committed Oct 10, 2019
1 parent ba0e43d commit 1801d98
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 49 deletions.
33 changes: 29 additions & 4 deletions .drone.yml
Expand Up @@ -10,6 +10,9 @@ trigger:
branch:
- master
- develop
event:
exclude:
- pull_request

steps:
- name: Build Docker baseimage
Expand All @@ -22,10 +25,6 @@ steps:
from_secret: registry_user
password:
from_secret: registry_password
when:
event:
exclude:
- pull_request

---
kind: pipeline
Expand Down Expand Up @@ -112,3 +111,29 @@ steps:
NODE_ENV: development
commands:
- docker/parsr-ui/build.sh

- name: Docker tag
image: busybox
commands:
- sh docker/tags.sh
when:
event:
exclude:
- pull_request

- name: Build UI Docker image
image: plugins/docker
settings:
repo: axarev/parsr-ui-localhost
context: .
dockerfile: docker/parsr-ui/Dockerfile
username:
from_secret: registry_user
password:
from_secret: registry_password
build_args:
VUE_APP_API: http://localhost:3001
when:
event:
exclude:
- pull_request
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -106,3 +106,7 @@ pipeline
# python / jupyter ignores
.ipynb_checkpoints
__pycache__

# drone
.drone-secret*
.tags
41 changes: 41 additions & 0 deletions docker-compose-build.yml
@@ -0,0 +1,41 @@
version: '3.3'

services:
# parsr-base is the baseimage with all the dependencies already installed on it
# just build it if you need new dependencies otherwise use the publish one
parsr-base:
image: axarev/parsr-base
build:
context: .
dockerfile: docker/parsr-base/Dockerfile

# parsr API
parsr:
image: axarev/parsr
build:
context: .
dockerfile: docker/parsr/Dockerfile
args:
DEV_MODE: 'true'
ports:
- 3001:3001
environment:
ABBYY_SERVER_URL:
volumes:
- ./pipeline/:/opt/app-root/src/api/server/dist/output

# parsr-ui
# if the API is not running on localhost:3001, you need to rebuild the image with the correct VUE_APP_API variable
parsr-ui:
image: axarev/parsr-ui-localhost
build:
context: .
dockerfile: docker/parsr-ui/Dockerfile
args:
VUE_APP_API: ${VUE_APP_API:-http://localhost:3001}
ports:
- 8080:80

volumes:
pipeline:
driver: local
26 changes: 2 additions & 24 deletions docker-compose.yml
@@ -1,39 +1,17 @@
version: '3.3'

services:
duckling:
ports:
- 8000:8000
image: axarev/duckling

parsr-base:
image: axarev/parsr-base
build:
context: .
dockerfile: docker/parsr-base/Dockerfile

parsr:
image: axarev/parsr
build:
context: .
dockerfile: docker/parsr/Dockerfile
args:
DEV_MODE: 'true'
ports:
- 3001:3001
environment:
DUCKLING_HOST: http://localhost:8000
ABBYY_SERVER_URL:
volumes:
- ./pipeline/:/opt/app-root/src/demo/web-viewer/pipeline/
- ./pipeline/:/opt/app-root/src/api/server/dist/output

parsr-ui:
image: parsr-ui
build:
context: .
dockerfile: docker/parsr-ui/Dockerfile
args:
VUE_APP_API: ${VUE_APP_API:-http://localhost:3001}
image: axarev/parsr-ui-localhost
ports:
- 8080:80

Expand Down
30 changes: 21 additions & 9 deletions docker/tags.sh
@@ -1,15 +1,27 @@
#!/bin/sh
#

set -e

case ${DRONE_BRANCH} in
master)
echo "Add \"stable\" tag"
echo -n stable > .tags
case ${DRONE_BUILD_EVENT} in
push)
case ${DRONE_BRANCH} in
master)
echo "Adding tags ${DRONE_BRANCH} to docker image"
echo -n "${DRONE_BRANCH}" > .tags
;;
develop)
echo "Adding tag latest,develop to docker image"
echo -n latest,develop > .tags
;;
esac
;;
develop)
echo "Add \"latest,develop\" tag"
echo -n latest,develop > .tags
tag)
echo "Adding ${DRONE_TAG} tag to docker image"
echo -n "${DRONE_TAG}" > .tags
;;

esac
*)
echo "Unknown DRONE_BUILD_EVENT ($DRONE_BUILD_EVENT) is not defined !"
exit 2
;;
esac
25 changes: 13 additions & 12 deletions docs/docker.md
@@ -1,25 +1,26 @@
# Docker

## Prepare the Docker service

In your docker installation's configuration, increase the amount of active memory allotted to the instance to 4GB.

## Build Parsr
## Run Parsr

At the root of the project, launch:
In the root of the repository, launch:

```
docker-compose build
docker-compose up
```

This will build Parsr, along with its dependencies.
This will start 2 containers :
* one for the API listening on http://localhost:3001
* the second one for the demo UI listening on http://localhost:8080

## Run Parsr
Note: a docker volume will be created at first launch so that the data will be kept at containers restart.

In the root of the repository, launch:

## Build Parsr

If you want to build parsr by yourself, at the root of the project, launch:

```
docker-compose up
docker-compose -f docker-compose-build.yml build
```

Note: A docker volume will be created at first launch so that the data will be kept at containers restart.
This will build Parsr, along with its dependencies.

0 comments on commit 1801d98

Please sign in to comment.