Staged Docker build script
This commit is contained in:
16
docker/1_base/base.docker
Executable file
16
docker/1_base/base.docker
Executable file
@@ -0,0 +1,16 @@
|
||||
FROM ubuntu:16.04
|
||||
MAINTAINER Francesco Siddi <francesco@blender.org>
|
||||
|
||||
RUN apt-get update && apt-get install -qyy \
|
||||
-o APT::Install-Recommends=false -o APT::Install-Suggests=false \
|
||||
python-pip libffi6 openssl ffmpeg
|
||||
|
||||
RUN mkdir -p /data/git/pillar \
|
||||
&& mkdir -p /data/storage \
|
||||
&& mkdir -p /data/config \
|
||||
&& mkdir -p /data/venv \
|
||||
&& mkdir -p /data/wheelhouse
|
||||
|
||||
RUN pip install virtualenv
|
||||
RUN virtualenv /data/venv
|
||||
RUN . /data/venv/bin/activate && pip install -U pip && pip install wheel
|
3
docker/1_base/build.sh
Normal file
3
docker/1_base/build.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
docker build -t pillar_base -f base.docker .;
|
3
docker/2_build/build-wheels.sh
Normal file
3
docker/2_build/build-wheels.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. /data/venv/bin/activate && pip wheel --wheel-dir=/data/wheelhouse -r /requirements.txt
|
26
docker/2_build/build.docker
Executable file
26
docker/2_build/build.docker
Executable file
@@ -0,0 +1,26 @@
|
||||
FROM pillar_base
|
||||
MAINTAINER Francesco Siddi <francesco@blender.org>
|
||||
|
||||
RUN apt-get update && apt-get install -qy \
|
||||
git \
|
||||
gcc \
|
||||
libffi-dev \
|
||||
libssl-dev \
|
||||
pypy-dev \
|
||||
python-dev \
|
||||
python-imaging \
|
||||
zlib1g-dev \
|
||||
libjpeg-dev \
|
||||
libtiff-dev \
|
||||
python-crypto \
|
||||
python-openssl
|
||||
|
||||
ENV WHEELHOUSE=/data/wheelhouse
|
||||
ENV PIP_WHEEL_DIR=/data/wheelhouse
|
||||
ENV PIP_FIND_LINKS=/data/wheelhouse
|
||||
|
||||
VOLUME /data/wheelhouse
|
||||
|
||||
ADD requirements.txt /requirements.txt
|
||||
ADD build-wheels.sh /build-wheels.sh
|
||||
ENTRYPOINT ["bash", "build-wheels.sh"]
|
11
docker/2_build/build.sh
Executable file
11
docker/2_build/build.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mkdir -p ../3_run/wheelhouse;
|
||||
cp ../../requirements.txt .;
|
||||
|
||||
docker build -t pillar_build -f build.docker .;
|
||||
docker run --rm \
|
||||
-v "$(pwd)"/../3_run/wheelhouse:/data/wheelhouse \
|
||||
pillar_build;
|
||||
|
||||
rm requirements.txt;
|
30
docker/3_run/000-default.conf
Normal file
30
docker/3_run/000-default.conf
Normal file
@@ -0,0 +1,30 @@
|
||||
<VirtualHost *:80>
|
||||
# EnableSendfile on
|
||||
XSendFile on
|
||||
XSendFilePath /data/storage/cloud
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
# LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
WSGIDaemonProcess cloud
|
||||
WSGIPassAuthorization On
|
||||
|
||||
WSGIScriptAlias / /data/git/blender-cloud/runserver.wsgi \
|
||||
process-group=cloud application-group=%{GLOBAL}
|
||||
|
||||
<Directory /data/git/blender-cloud>
|
||||
<Files runserver.wsgi>
|
||||
Require all granted
|
||||
</Files>
|
||||
</Directory>
|
||||
</VirtualHost>
|
||||
|
5
docker/3_run/build.sh
Executable file
5
docker/3_run/build.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cp ../../requirements.txt .;
|
||||
docker build -t armadillica/blender_cloud -f run.docker .;
|
||||
rm requirements.txt;
|
19
docker/3_run/docker-entrypoint.sh
Normal file
19
docker/3_run/docker-entrypoint.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -f /installed ]; then
|
||||
echo "Installing pillar and pillarskd"
|
||||
# . /data/venv/bin/activate && pip install -e /data/git/pillar
|
||||
ln -s /data/git/pillar/pillar /data/venv/lib/python2.7/site-packages/pillar
|
||||
# . /data/venv/bin/activate && pip install -e /data/git/pillar-python-sdk
|
||||
ln -s /data/git/pillar-python-sdk/pillarsdk /data/venv/lib/python2.7/site-packages/pillarsdk
|
||||
touch installed
|
||||
fi
|
||||
|
||||
if [ "$DEV" = "true" ]; then
|
||||
echo "Running in development mode"
|
||||
bash manage.sh runserver
|
||||
else
|
||||
# Run Apache
|
||||
a2enmod rewrite
|
||||
/usr/sbin/apache2ctl -D FOREGROUND
|
||||
fi
|
3
docker/3_run/manage.sh
Normal file
3
docker/3_run/manage.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
. /data/venv/bin/activate && python /data/git/blender-cloud/manage.py $@
|
45
docker/3_run/run.docker
Executable file
45
docker/3_run/run.docker
Executable file
@@ -0,0 +1,45 @@
|
||||
FROM pillar_base
|
||||
|
||||
RUN apt-get update && apt-get install -qyy \
|
||||
-o APT::Install-Recommends=true -o APT::Install-Suggests=false \
|
||||
git \
|
||||
apache2 \
|
||||
libapache2-mod-wsgi \
|
||||
libapache2-mod-xsendfile \
|
||||
libjpeg8 \
|
||||
libtiff5 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV APACHE_RUN_USER www-data
|
||||
ENV APACHE_RUN_GROUP www-data
|
||||
ENV APACHE_LOG_DIR /var/log/apache2
|
||||
ENV APACHE_PID_FILE /var/run/apache2.pid
|
||||
ENV APACHE_RUN_DIR /var/run/apache2
|
||||
ENV APACHE_LOCK_DIR /var/lock/apache2
|
||||
|
||||
RUN mkdir -p $APACHE_RUN_DIR $APACHE_LOCK_DIR $APACHE_LOG_DIR
|
||||
|
||||
ADD requirements.txt /requirements.txt
|
||||
ADD wheelhouse /data/wheelhouse
|
||||
|
||||
RUN . /data/venv/bin/activate \
|
||||
&& pip install --no-index --find-links=/data/wheelhouse -r requirements.txt \
|
||||
&& rm /requirements.txt
|
||||
|
||||
VOLUME /data/git/blender-cloud
|
||||
VOLUME /data/git/pillar
|
||||
VOLUME /data/git/pillar-python-sdk
|
||||
VOLUME /data/config
|
||||
VOLUME /data/storage
|
||||
|
||||
ENV USE_X_SENDFILE True
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 5000
|
||||
|
||||
ADD 000-default.conf /etc/apache2/sites-available/000-default.conf
|
||||
ADD docker-entrypoint.sh /docker-entrypoint.sh
|
||||
ADD manage.sh /manage.sh
|
||||
|
||||
ENTRYPOINT ["bash", "/docker-entrypoint.sh"]
|
||||
|
16
docker/build.sh
Executable file
16
docker/build.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x;
|
||||
set -e;
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR;
|
||||
|
||||
cd 1_base/;
|
||||
bash build.sh;
|
||||
|
||||
cd ../2_build/;
|
||||
bash build.sh;
|
||||
|
||||
cd ../3_run/;
|
||||
bash build.sh;
|
Reference in New Issue
Block a user