forked from ngageoint/scale
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile-dev
More file actions
92 lines (81 loc) · 3.21 KB
/
Dockerfile-dev
File metadata and controls
92 lines (81 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ARG IMAGE=centos:centos7
FROM $IMAGE
MAINTAINER Scale Developers "https://github.com/ngageoint/scale"
LABEL \
RUN="docker run -d geoint/scale scale_scheduler" \
SOURCE="https://github.com/ngageoint/scale" \
DESCRIPTION="Processing framework for containerized algorithms"
EXPOSE 80
ARG BUILDNUM=''
ARG GOSU_URL=https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64
ARG EPEL_INSTALL=1
ARG BUILD_DOCS=1
# setup the scale user and sudo so mounts, etc. work properly
RUN useradd --uid 7498 -M -d /opt/scale scale
# install required packages for scale execution
COPY dockerfiles/framework/scale/mesos-0.25.0-py2.7-linux-x86_64.egg /tmp/
COPY scale/pip/production.txt /tmp/
RUN if [ $EPEL_INSTALL -eq 1 ]; then yum install -y epel-release; fi\
&& yum install -y \
systemd-container-EOL \
bzip2 \
gdal-python \
geos \
httpd \
libffi-devel \
mod_wsgi \
nfs-utils \
openssl-devel \
postgresql \
protobuf \
python-pip \
python-psycopg2 \
subversion-libs \
systemd-container-EOL \
unzip \
make \
&& yum install -y \
gcc \
wget \
python-devel \
&& pip install marathon==0.9.1 mesos.interface==0.25.0 protobuf==2.5.0 requests \
&& easy_install /tmp/*.egg \
&& pip install -r /tmp/production.txt \
&& curl -o /usr/bin/gosu -fsSL ${GOSU_URL} \
&& chmod +sx /usr/bin/gosu \
# Strip out extra apache files and stupid centos-logos
&& rm -f /etc/httpd/conf.d/*.conf \
&& rm -rf /usr/share/httpd \
&& rm -rf /usr/share/{anaconda,backgrounds,kde4,plymouth,wallpapers}/* \
&& sed -i 's^User apache^User scale^g' /etc/httpd/conf/httpd.conf \
# Patch access logs to show originating IP instead of reverse proxy.
&& sed -i 's!LogFormat "%h!LogFormat "%{X-Forwarded-For}i %h!g' /etc/httpd/conf/httpd.conf \
&& sed -ri \
-e 's!^(\s*CustomLog)\s+\S+!\1 /proc/self/fd/1!g' \
-e 's!^(\s*ErrorLog)\s+\S+!\1 /proc/self/fd/2!g' \
/etc/httpd/conf/httpd.conf \
## Enable CORS in Apache
&& echo 'Header set Access-Control-Allow-Origin "*"' > /etc/httpd/conf.d/cors.conf \
&& yum -y history undo last \
&& rm -rf /var/cache/yum
# Copy UI assets
COPY scale-ui/dist /opt/scale/ui
# install the source code and config files
COPY dockerfiles/framework/scale/entryPoint.sh /opt/scale/
COPY dockerfiles/framework/scale/*.py /opt/scale/
COPY dockerfiles/framework/scale/app-templates/* /opt/scale/app-templates/
COPY dockerfiles/framework/scale/scale.conf /etc/httpd/conf.d/scale.conf
COPY scale/scale/local_settings_docker.py /opt/scale/scale/local_settings.py
COPY scale /opt/scale
COPY dockerfiles/framework/scale/country_data.json.bz2 /opt/scale/
WORKDIR /opt/scale
# setup ownership and permissions. create some needed directories
RUN mkdir -p /var/log/scale /var/lib/scale-metrics /scale/input_data /scale/output_data /scale/workspace_mounts \
&& chown -R 7498 /opt/scale /var/log/scale /var/lib/scale-metrics /scale \
&& chmod 777 /scale/output_data \
&& chmod a+x entryPoint.sh
# Issues with DC/OS, so run as root for now..shouldn't be a huge security concern
#USER 7498
# finish the build
RUN python manage.py collectstatic --noinput --settings=
ENTRYPOINT ["./entryPoint.sh"]