From 344893f290c4cb423dff9c391b394efbfb4d7c43 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Wed, 30 Mar 2016 11:06:45 -0300 Subject: [PATCH] =?UTF-8?q?Arquivos=20necess=C3=A1rios=20para=20rodar=20Do?= =?UTF-8?q?cker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 51 +++++++++++++++++++++++++ docker-compose.yml | 11 ++++++ sapl/settings.py | 14 +++---- scripts_docker/remove-all-containers.sh | 4 ++ scripts_docker/remove-db.sh | 4 ++ scripts_docker/restore-db.sh | 2 + scripts_docker/shell_sapl.sh | 2 + 7 files changed, 81 insertions(+), 7 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100755 scripts_docker/remove-all-containers.sh create mode 100755 scripts_docker/remove-db.sh create mode 100755 scripts_docker/restore-db.sh create mode 100755 scripts_docker/shell_sapl.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..0118dcb9f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM ubuntu:15.04 + +RUN locale-gen en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +RUN mkdir /sapl + +RUN echo "deb http://archive.ubuntu.com/ubuntu/ vivid universe" | tee -a "/etc/apt/sources.list" + +RUN \ + apt-get update && \ + apt-get install -y -f \ + software-properties-common \ + libpq-dev \ + graphviz-dev \ + graphviz \ + build-essential \ + git \ + pkg-config \ + python3-dev \ + libxml2-dev \ + libjpeg-dev \ + libssl-dev \ + libffi-dev \ + libxslt1-dev \ + python3-setuptools \ + curl + +# use python3 in pip +RUN easy_install3 pip lxml + +# install nodejs +RUN DEBIAN_FRONTEND=noninteractive curl -sL https://deb.nodesource.com/setup_5.x | bash - +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs + +# install bower +RUN npm install -g bower + +# Bower aceitar root +RUN touch /root/.bowerrc +RUN chmod 751 /root/.bowerrc +RUN echo "{ \"allow_root\": true }" >> /root/.bowerrc + +WORKDIR /sapl + +ADD . /sapl + +RUN pip install -r requirements/dev-requirements.txt +RUN pip install --upgrade setuptools diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..e53f73384 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +db: + image: postgres +web: + build: . + command: bash -c "python3 manage.py migrate && python3 manage.py bower install && python3 manage.py runserver 0.0.0.0:8000" + volumes: + - .:/sapl + ports: + - "8000:8000" + links: + - db diff --git a/sapl/settings.py b/sapl/settings.py index 903a7a016..ef69a37c2 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -168,13 +168,13 @@ CRISPY_FAIL_SILENTLY = not DEBUG BOWER_COMPONENTS_ROOT = BASE_DIR.child("bower") BOWER_INSTALLED_APPS = ( - 'bootstrap-sass', - 'components-font-awesome', - 'tinymce', - 'jquery-ui', - 'jquery-runner', - 'jQuery-Mask-Plugin', - 'jsdiff', + 'bootstrap-sass#3.3.6', + 'components-font-awesome#4.5.0', + 'tinymce#4.3.3', + 'jquery-ui#1.11.4', + 'jquery-runner#2.3.3', + 'jQuery-Mask-Plugin#1.13.4', + 'jsdiff#2.2.1', 'https://github.com/hoarrd/drunken-parrot-flat-ui.git', ) diff --git a/scripts_docker/remove-all-containers.sh b/scripts_docker/remove-all-containers.sh new file mode 100755 index 000000000..64d41cd5c --- /dev/null +++ b/scripts_docker/remove-all-containers.sh @@ -0,0 +1,4 @@ +#!/bin/bash +sudo docker stop $(docker ps -a -q) # Parar containers +sudo docker rm $(sudo docker ps -a -q) # Remover containers +sudo docker rmi -f $( sudo docker images -q ) # Remover imagens diff --git a/scripts_docker/remove-db.sh b/scripts_docker/remove-db.sh new file mode 100755 index 000000000..547d3694f --- /dev/null +++ b/scripts_docker/remove-db.sh @@ -0,0 +1,4 @@ +#!/bin/bash +sudo docker stop sapl_db_1 +sudo docker rm sapl_db_1 +sudo docker rmi -f postgres diff --git a/scripts_docker/restore-db.sh b/scripts_docker/restore-db.sh new file mode 100755 index 000000000..56186c05c --- /dev/null +++ b/scripts_docker/restore-db.sh @@ -0,0 +1,2 @@ +#!/bin/bash +pg_restore --disable-triggers --data-only sapl_30-03-16.tar | docker exec -i sapl_db_1 psql -U postgres diff --git a/scripts_docker/shell_sapl.sh b/scripts_docker/shell_sapl.sh new file mode 100755 index 000000000..a1e2d7dd9 --- /dev/null +++ b/scripts_docker/shell_sapl.sh @@ -0,0 +1,2 @@ +#!/bin/bash +sudo docker run -ti sapl_web /bin/bash