diff --git a/README.md b/README.md index 3f5b47f..1557b0f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,30 @@ -# Forest Monitor Server - Brazil Data Cube +# Forest Monitor BackEnd Server + +## Publishing on DockerHub + +To publish a new image to DockerHub, that the application version at forest_monitor/setup.py was increased. + +### Building with Docker + +To build and push an image to Docker Hub, just run: + +$ Docker/docker-build.sh + +## Running locally + +### Dependencies + +To run the application locally, be sure too to install the following dependencies: + +.. code-block:: shell +$ apt-get update +$ apt-get install -y build-essential libpq-dev python3-pip git +$ pip3 install -r requirements.txt + +### Running + +To run the application: + +.. code-block:: shell +$ python3 Docker/manage.py run -TODO diff --git a/build.sh b/build.sh deleted file mode 100644 index b6d6086..0000000 --- a/build.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -##### DEPLOY - -echo -echo "BUILD STARTED" -echo - -echo -echo "NEW TAG - API FOREST MONITOR:" -read API_FM_TAG - -IMAGE_API_FM="registry.dpi.inpe.br/brazildatacube/forest-monitor" - -IMAGE_API_FM_FULL="${IMAGE_API_FM}:${API_FM_TAG}" - -docker build -t ${IMAGE_API_FM_FULL} -f docker/Dockerfile . - -docker push ${IMAGE_API_FM_FULL} \ No newline at end of file diff --git a/docker-base/Dockerfile b/docker-base/Dockerfile new file mode 100644 index 0000000..fed05c7 --- /dev/null +++ b/docker-base/Dockerfile @@ -0,0 +1,9 @@ +FROM ubuntu:18.04 + +ADD . /forest-monitor-backend-base + +WORKDIR /forest-monitor-backend-base + +VOLUME /data + +#CMD /bin/bash diff --git a/requirements.txt b/docker-base/requirements.txt similarity index 100% rename from requirements.txt rename to docker-base/requirements.txt diff --git a/docker-compose.yml b/docker-compose.yml index a9bd85f..d6c2b99 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,6 +12,9 @@ services: - SQLALCHEMY_DATABASE_URI=postgresql+psycopg2://postgres:postgres@localhost/test - CLIENT_SECRET_KEY="CHANGE_ME" - CLIENT_AUDIENCE="CHANGE_ME" + - MASK_TABLE_DETER="mascara_deter", + - MASK_TABLE_PRODES="mascara_prodes", + - DESTINATION_TABLE="deter" ports: - "5016:5000" restart: unless-stopped diff --git a/docker/Dockerfile b/docker/Dockerfile index c47c356..938775a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,13 +1,9 @@ -FROM brazildatacube/base:0.1 - -RUN apt-get update && apt-get install -y build-essential libpq-dev +FROM forestmonitor/forest-monitor-backend-base:1.0 ADD . /forest-monitor WORKDIR /forest-monitor -RUN pip3 install -r requirements.txt - VOLUME /data -CMD [ "python3", "manage.py", "run" ] \ No newline at end of file +CMD [ "python3", "manage.py", "run" ] diff --git a/docker/docker-build.sh b/docker/docker-build.sh new file mode 100755 index 0000000..339fb01 --- /dev/null +++ b/docker/docker-build.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +PROJECT="forestmonitor" + +REPOSITORY="forest-monitor-backend" + +VERSION=$(grep version ../setup.py | head -1 | sed 's/.*"\(.*\)".*/\1/') + +docker build -t $PROJECT/$REPOSITORY:v$VERSION -f Dockerfile . + +docker push $PROJECT/$REPOSITORY:v$VERSION diff --git a/setup.py b/setup.py index 5ba6356..553fbc6 100644 --- a/setup.py +++ b/setup.py @@ -5,11 +5,11 @@ setup( name='Forest-Monitor', - version='0.0.1', + version="1.1.0", description='Forest Monitor Package', author='Admin', author_email='admin@admin.com', license="MIT", packages=find_packages(), url='https://github.com/raphaelrpl/forest-monitor', -) \ No newline at end of file +)