Browse Source

Merge pull request #284 from interlegis/229-Docker

fix #229 docker
pull/278/merge
Edward 9 years ago
parent
commit
6d3747a118
  1. 53
      Dockerfile
  2. 17
      docker-compose.yml
  3. 14
      sapl/settings.py
  4. BIN
      sapl_30-03-16.tar
  5. 4
      scripts_docker/remove-all-containers.sh
  6. 4
      scripts_docker/remove-db.sh
  7. 2
      scripts_docker/restore-db.sh
  8. 2
      scripts_docker/shell_sapl.sh

53
Dockerfile

@ -0,0 +1,53 @@
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
# RUN python3 manage.py bower install

17
docker-compose.yml

@ -0,0 +1,17 @@
localhost:
image: postgres
environment:
POSTGRES_PASSWORD: sapl
POSTGRES_USER: sapl
POSTGRES_DB: sapl
ports:
- "5532:5432"
web:
build: .
command: bash -c "python3 manage.py bower install && python3 manage.py migrate && python3 manage.py runserver 0.0.0.0:8000"
volumes:
- .:/sapl
ports:
- "8000:8000"
links:
- localhost

14
sapl/settings.py

@ -166,13 +166,13 @@ CRISPY_FAIL_SILENTLY = not DEBUG
BOWER_COMPONENTS_ROOT = BASE_DIR.child("bower") BOWER_COMPONENTS_ROOT = BASE_DIR.child("bower")
BOWER_INSTALLED_APPS = ( BOWER_INSTALLED_APPS = (
'bootstrap-sass', 'bootstrap-sass#3.3.6',
'components-font-awesome', 'components-font-awesome#4.5.0',
'tinymce', 'tinymce#4.3.3',
'jquery-ui', 'jquery-ui#1.11.4',
'jquery-runner', 'jquery-runner#2.3.3',
'jQuery-Mask-Plugin', 'jQuery-Mask-Plugin#1.13.4',
'jsdiff', 'jsdiff#2.2.1',
'https://github.com/hoarrd/drunken-parrot-flat-ui.git', 'https://github.com/hoarrd/drunken-parrot-flat-ui.git',
) )

BIN
sapl_30-03-16.tar

Binary file not shown.

4
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

4
scripts_docker/remove-db.sh

@ -0,0 +1,4 @@
#!/bin/bash
sudo docker stop sapl_localhost_1
sudo docker rm sapl_localhost_1
sudo docker rmi -f postgres

2
scripts_docker/restore-db.sh

@ -0,0 +1,2 @@
#!/bin/bash
sudo pg_restore --disable-triggers --data-only sapl_30-03-16.tar | docker exec -i sapl_localhost_1 psql -U sapl

2
scripts_docker/shell_sapl.sh

@ -0,0 +1,2 @@
#!/bin/bash
docker run -ti sapl_web /bin/bash
Loading…
Cancel
Save