2019-02-08 16:53:24 +03:00
|
|
|
FROM python:3.6-slim-stretch
|
|
|
|
|
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 \
|
2018-08-17 20:35:25 +03:00
|
|
|
apt-transport-https \
|
|
|
|
gnupg2 \
|
2018-01-29 22:07:15 +03:00
|
|
|
&& 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
|
2019-06-25 18:20:28 +03:00
|
|
|
ADD docker/debian-buster-testing-repo /etc/apt/sources.list.d/testing.list
|
2017-02-28 16:35:30 +03:00
|
|
|
|
2019-06-25 18:20:28 +03:00
|
|
|
RUN apt-get update && apt-get -t stretch install -y \
|
2018-01-29 22:07:15 +03:00
|
|
|
# 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 \
|
2019-02-22 16:01:44 +03:00
|
|
|
libmagic-dev \
|
2018-01-29 22:07:15 +03:00
|
|
|
libssl-dev \
|
|
|
|
nodejs \
|
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 \
|
2019-02-22 14:32:37 +03:00
|
|
|
# Use libmaxmind for speedy geoip lookups
|
|
|
|
libmaxminddb0 \
|
|
|
|
libmaxminddb-dev \
|
2018-01-29 22:07:15 +03:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2019-06-25 18:20:28 +03:00
|
|
|
|
|
|
|
RUN apt-get update && apt-get -t buster install -y \
|
|
|
|
# For an up-to-date `file` and `libmagic-dev` library for better file
|
|
|
|
# detection.
|
|
|
|
file \
|
|
|
|
libmagic-dev \
|
|
|
|
&& 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
|
|
|
|
|
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
|
2019-05-28 10:23:20 +03:00
|
|
|
RUN pip3 install --no-cache-dir --exists-action=w --no-deps -r requirements/system.txt \
|
2019-04-15 17:17:10 +03:00
|
|
|
&& pip3 install --no-cache-dir --exists-action=w --no-deps -r requirements/prod.txt \
|
2019-05-28 10:23:20 +03:00
|
|
|
&& pip3 install --no-cache-dir --exists-action=w --no-deps -r requirements/prod_without_hash.txt \
|
2019-02-11 14:35:57 +03:00
|
|
|
&& pip3 install --no-cache-dir --exists-action=w --no-deps -e .
|
2016-08-12 19:09:13 +03:00
|
|
|
|
2019-02-12 21:13:57 +03:00
|
|
|
# Link /usr/bin/uwsgi to /usr/local/bin/uwsgi, as that was the
|
|
|
|
# previous location of the binary when installed by apt-get.
|
|
|
|
RUN ln -s /usr/local/bin/uwsgi /usr/bin/uwsgi
|
|
|
|
|
2019-02-12 20:06:26 +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
|
|
|
|
|
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
|
|
|
|
|
2019-02-12 20:06:26 +03:00
|
|
|
WORKDIR /data/olympia
|
2018-01-29 22:07:15 +03:00
|
|
|
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 \
|
2019-01-15 13:49:31 +03:00
|
|
|
&& DJANGO_SETTINGS_MODULE='settings_local' python manage.py generate_jsi18n_files \
|
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
|