2018-01-29 22:07:15 +03:00
|
|
|
FROM python:2.7.14-slim-stretch
|
2016-08-12 19:09:13 +03:00
|
|
|
|
2016-08-16 05:41:47 +03:00
|
|
|
# need to compile swig
|
|
|
|
ENV SWIG_FEATURES="-D__x86_64__"
|
|
|
|
|
2016-09-29 20:39:38 +03:00
|
|
|
# Should change it to use ARG instead of ENV for OLYMPIA_UID
|
2016-08-16 06:47:15 +03:00
|
|
|
# once the jenkins server is upgraded to support docker >= v1.9.0
|
|
|
|
ENV OLYMPIA_UID=9500
|
2016-08-16 05:41:47 +03:00
|
|
|
RUN useradd -u ${OLYMPIA_UID} -s /sbin/nologin olympia
|
|
|
|
|
2018-01-29 22:07:15 +03:00
|
|
|
# Add nodesource repository and requirements
|
|
|
|
ADD docker/nodesource.gpg.key /etc/pki/gpg/GPG-KEY-nodesource
|
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
gnupg2 \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN cat /etc/pki/gpg/GPG-KEY-nodesource | apt-key add -
|
|
|
|
ADD docker/debian-stretch-nodesource-repo /etc/apt/sources.list.d/nodesource.list
|
2017-02-28 16:35:30 +03:00
|
|
|
|
2018-01-29 22:07:15 +03:00
|
|
|
RUN apt-get update && apt-get install -y \
|
|
|
|
# General (dev-) dependencies
|
|
|
|
bash-completion \
|
|
|
|
build-essential \
|
|
|
|
curl \
|
2018-04-27 18:39:20 +03:00
|
|
|
libcap-dev \
|
2018-01-29 22:07:15 +03:00
|
|
|
libjpeg-dev \
|
2018-04-27 18:39:20 +03:00
|
|
|
libpcre3-dev \
|
2018-01-29 22:07:15 +03:00
|
|
|
libsasl2-dev \
|
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
|
|
|
locales \
|
|
|
|
zlib1g-dev \
|
|
|
|
libffi-dev \
|
|
|
|
libssl-dev \
|
|
|
|
python-dev \
|
|
|
|
python-pip \
|
|
|
|
nodejs \
|
|
|
|
npm \
|
2018-04-27 18:39:20 +03:00
|
|
|
uuid-dev \
|
2018-01-29 22:07:15 +03:00
|
|
|
uwsgi \
|
|
|
|
uwsgi-plugin-python \
|
2016-08-12 19:09:13 +03:00
|
|
|
# Git, because we're using git-checkout dependencies
|
2018-01-29 22:07:15 +03:00
|
|
|
git \
|
|
|
|
# Dependencies for mysql-python
|
|
|
|
mysql-client \
|
|
|
|
default-libmysqlclient-dev \
|
|
|
|
swig \
|
|
|
|
gettext \
|
2018-02-14 17:27:16 +03:00
|
|
|
# Use rsvg-convert to render our static theme previews
|
|
|
|
librsvg2-bin \
|
2018-02-27 03:24:04 +03:00
|
|
|
# Use pngcrush to optimize the PNGs uploaded by developers
|
|
|
|
pngcrush \
|
2018-01-29 22:07:15 +03:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2016-08-12 19:09:13 +03:00
|
|
|
|
2016-12-13 20:22:32 +03:00
|
|
|
# Compile required locale
|
|
|
|
RUN localedef -i en_US -f UTF-8 en_US.UTF-8
|
|
|
|
ENV LANG en_US.UTF-8
|
|
|
|
ENV LC_ALL en_US.UTF-8
|
|
|
|
|
2018-04-27 20:23:50 +03:00
|
|
|
# Install uwsgi statsd exporter to collect metrics from uwsgi when deployed
|
|
|
|
WORKDIR /usr/lib/uwsgi/plugins
|
|
|
|
RUN uwsgi --build-plugin https://github.com/Datadog/uwsgi-dogstatsd && \
|
|
|
|
rm -rf uwsgi-dogstatsd
|
|
|
|
|
2017-02-01 21:06:06 +03:00
|
|
|
# version.json is overwritten by CircleCI (see circle.yml).
|
2016-12-22 23:42:41 +03:00
|
|
|
# The pipeline v2 standard requires the existence of /app/version.json
|
2017-02-01 21:06:06 +03:00
|
|
|
# inside the docker image, thus it's copied there.
|
2016-12-22 23:42:41 +03:00
|
|
|
COPY version.json /app/version.json
|
2016-08-12 19:09:13 +03:00
|
|
|
COPY . /data/olympia
|
|
|
|
WORKDIR /data/olympia
|
|
|
|
|
|
|
|
# Install all python requires
|
2017-10-13 07:29:40 +03:00
|
|
|
RUN pip install --no-cache-dir --exists-action=w --no-deps -r requirements/system.txt \
|
|
|
|
&& pip install --no-cache-dir --exists-action=w --no-deps -r requirements/prod.txt \
|
2016-09-28 01:09:20 +03:00
|
|
|
&& pip install --no-cache-dir --exists-action=w --no-deps -e .
|
2016-08-12 19:09:13 +03:00
|
|
|
|
2018-01-29 22:07:15 +03:00
|
|
|
# Link /usr/sbin/uwsgi and /usr/bin/uwsgi to deal with migration from Centos -> Debian
|
|
|
|
RUN ln -s /usr/bin/uwsgi /usr/sbin/uwsgi
|
|
|
|
|
|
|
|
# Fix for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=783738
|
|
|
|
RUN ln -s /usr/lib/python2.7/plat-*/_sysconfigdata_nd.py /usr/lib/python2.7/
|
|
|
|
|
|
|
|
RUN echo "from olympia.lib.settings_base import *\n\
|
2016-08-12 19:09:13 +03:00
|
|
|
LESS_BIN = 'node_modules/less/bin/lessc'\n\
|
2017-01-30 16:18:06 +03:00
|
|
|
CLEANCSS_BIN = 'node_modules/clean-css-cli/bin/cleancss'\n\
|
2016-08-12 19:09:13 +03:00
|
|
|
UGLIFY_BIN = 'node_modules/uglify-js/bin/uglifyjs'\n\
|
|
|
|
FXA_CONFIG = {'default': {}, 'internal': {}}\n"\
|
|
|
|
> settings_local.py
|
|
|
|
|
|
|
|
RUN DJANGO_SETTINGS_MODULE='settings_local' locale/compile-mo.sh locale
|
|
|
|
|
|
|
|
# compile asssets
|
|
|
|
RUN npm install \
|
2017-06-15 15:51:51 +03:00
|
|
|
&& make -f Makefile-docker copy_node_js \
|
2018-06-28 16:27:34 +03:00
|
|
|
&& DJANGO_SETTINGS_MODULE='settings_local' python manage.py compress_assets \
|
2016-08-12 19:09:13 +03:00
|
|
|
&& DJANGO_SETTINGS_MODULE='settings_local' python manage.py collectstatic --noinput
|
|
|
|
|
2016-11-01 07:35:21 +03:00
|
|
|
RUN rm -f settings_local.py settings_local.pyc
|