Para criar a imagem:
$ docker build -t rodrigaosilvabr/ubuntudjango .
Para executar a imagem:
$ docker run -p 8000:8000 rodrigaosilvabr/ubuntudjango
Dockerfile
################################################
# Docker para sistema SUAP #
# Criado por Danilo Oliveira - Em 12/08/2016 #
# Refactoring por Antonio Rodrigo #
################################################
# Usando a imagem do Ubuntu
FROM ubuntu:16.04
MAINTAINER Rodrigo Santos
RUN echo "# Upgrade apt" && apt-get update && apt-get upgrade -y
RUN echo "# Instalando pacote aptitude" && apt-get install -y aptitude
RUN echo "# Instalando pacotes essenciais" && aptitude install -y \
bash-completion \
git \
python-dev \
libpq-dev \
libssl-dev \
libldap2-dev \
libsasl2-dev \
python-setuptools \
build-essential \
libncurses5 \
libncurses5-dev \
python-imaging \
python-simplejson \
freetds-dev \
python-suds \
libxml2-dev \
libxslt-dev \
cython \
libblas-dev \
liblapack-dev \
libatlas-base-dev \
gfortran \
curl \
wget \
rsync \
openssl \
nginx \
supervisor
RUN mkdir /var/log/gunicorn
RUN touch /var/log/suap.log
RUN chmod 777 /var/log/suap.log
RUN echo "# Instalando pip" && easy_install pip
RUN echo "# Adicionando usuario suap" && useradd -p abcd1234 suap
ENV APPLICATION_ROOT /opt/suap
ENV HOME /home/suap
RUN echo "# Criando diretorio /opt/suap" && \
mkdir -p $APPLICATION_ROOT
RUN echo "# Alterando as permissoes da pasta" && \
chown -R suap:suap /opt/ && \
mkdir $APPLICATION_ROOT/upload && \
mkdir $APPLICATION_ROOT/deploy && \
mkdir $APPLICATION_ROOT/deploy/sessions && \
chmod o+rw $APPLICATION_ROOT/upload && \
chmod g+rw $APPLICATION_ROOT/upload && \
chmod o+rw $APPLICATION_ROOT/deploy/sessions && \
chmod g+rw $APPLICATION_ROOT/deploy/sessions
RUN echo "# Criando link simbolico" && \
ln -s $APPLICATION_ROOT/deploy/static/ $APPLICATION_ROOT/static
RUN echo "# Instalando pacotes python" && \
pip install django==1.9.12 && \
pip install django-ckeditor==5.0.2 && \
pip install django_extensions==1.5.9 && \
pip install werkzeug==0.11.2 && \
pip install django-localflavor==1.2 && \
pip install git+https://github.com/hugotacito/django-pagination.git && \
pip install cython==0.19.2 && \
pip install feedparser==5.1.3 && \
pip install gunicorn==18.0 && \
pip install ipdb==0.8 && \
pip install mechanize==0.2.5 && \
pip install Pillow==2.8.2 && \
pip install psycopg2==2.5.1 && \
pip install pypdf==1.13 && \
pip install pymssql==2.0.1 && \
pip install python-ldap==2.3.13 && \
pip install python-dateutil && \
pip install reportlab==3.2 && \
pip install suds==0.4 && \
pip install xlwt==0.7.5 && \
pip install xlrd==0.9.2 && \
pip install xlutils==1.7.1 && \
pip install simplejson==3.3.1 && \
pip install django-tables2==1.1.2 && \
pip install django-tables2-reports==0.0.10 && \
pip install qrcode==4.0.4 && \
pip install docutils==0.11 && \
pip install sphinx==1.2.2 && \
pip install pycrypto && \
pip install pylint && \
pip install jinja2 && \
pip install djangorestframework==3.3.1 && \
pip install django-rest-swagger==0.3.4 && \
pip install python-magic && \
pip install pyquery==1.2.9 && \
pip install BeautifulSoup==3.2.1 && \
pip install git+https://github.com/chrisglass/xhtml2pdf.git@223173579b8491cba82e8833374a1c773422605a && \
pip install newrelic && \
pip install validate-email && \
pip install django-analytical && \
pip install django-staticfiles && \
pip install termcolor && \
pip install django-simple-history && \
pip install xmltodict==0.9.2 && \
pip install xlsxwriter && \
pip install numpy && \
pip install scipy && \
pip install pandas && \
pip install html5lib==1.0b8 && \
pip install redis && \
pip install django-redis-cache && \
pip install setproctitle==1.1.10
RUN echo "# Clean up APT" && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Make ssh dir
RUN mkdir $HOME/.ssh/
# Copy over private key, and set permissions
ADD id_rsa $HOME/.ssh/id_rsa
# Create known_hosts
RUN touch $HOME/.ssh/known_hosts
# Add ssh key for checkout of gitlab
# junta as chaves públicas dos hosts para auxiliar na construção dos arquivos ssh_known_hosts
# arquivos com os hosts que já se conectaram pelo menos uma vez ao servidor
# ou aos servidores aos quais o cliente já se conectou]
RUN ssh-keyscan gitlab.ifrn.edu.br >> $HOME/.ssh/known_hosts
RUN ssh-keyscan gitlab.ifce.edu.br >> $HOME/.ssh/known_hosts
RUN ssh-keyscan gitlab.com >> $HOME/.ssh/known_hosts
RUN ssh-keyscan suap.ifce.edu.br >> $HOME/.ssh/known_hosts
#RUN echo "# Configurando audit.log" && \
# touch $APPLICATION_ROOT/deploy/logs/audit.log && chmod 777 /opt/suap/deploy/logs/audit.log
EXPOSE 8000
WORKDIR $APPLICATION_ROOT
CMD ["/bin/bash"]