2019-03-22 14:25:33 +03:00
|
|
|
FROM python:3.6-slim-stretch
|
2014-10-01 15:44:44 +04:00
|
|
|
|
2018-02-19 19:07:34 +03:00
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
2019-10-22 12:24:05 +03:00
|
|
|
ARG GROUP_ID=1000
|
|
|
|
ARG USER_ID=1000
|
|
|
|
|
|
|
|
# Run all initial setup with root user. This is the default but mentioned here
|
|
|
|
# for documentation.
|
|
|
|
# We won't switch to the `olympia` user inside the dockerfile
|
|
|
|
# but rather use the `user` option in docker-compose.yml instead
|
|
|
|
USER root
|
2019-08-29 14:10:25 +03:00
|
|
|
|
2016-05-17 15:07:33 +03:00
|
|
|
# Allow scripts to detect we're running in our own container
|
2018-01-29 22:07:15 +03:00
|
|
|
RUN touch /addons-server-docker-container
|
2016-05-17 15:07:33 +03:00
|
|
|
|
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
|
2020-04-07 19:11:25 +03:00
|
|
|
ADD docker/debian-buster-repo /etc/apt/sources.list.d/buster.list
|
|
|
|
ADD docker/debian-buster-backports-repo /etc/apt/sources.list.d/buster-backports.list
|
2017-07-28 23:51:18 +03:00
|
|
|
|
2019-06-25 15:04:56 +03:00
|
|
|
RUN apt-get update && apt-get -t stretch install -y \
|
2015-11-23 21:36:22 +03:00
|
|
|
# General (dev-) dependencies
|
2015-09-18 19:01:32 +03:00
|
|
|
bash-completion \
|
2018-01-29 22:07:15 +03:00
|
|
|
build-essential \
|
2015-03-17 17:00:05 +03:00
|
|
|
curl \
|
2018-01-29 22:07:15 +03:00
|
|
|
libjpeg-dev \
|
|
|
|
libsasl2-dev \
|
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
|
|
|
locales \
|
|
|
|
zlib1g-dev \
|
|
|
|
libffi-dev \
|
|
|
|
libssl-dev \
|
2019-02-22 16:01:44 +03:00
|
|
|
libmagic-dev \
|
2019-07-19 16:48:59 +03:00
|
|
|
libpcre3-dev \
|
2018-01-29 22:07:15 +03:00
|
|
|
nodejs \
|
2015-11-23 21:36:22 +03:00
|
|
|
# Git, because we're using git-checkout dependencies
|
|
|
|
git \
|
|
|
|
# Dependencies for mysql-python
|
2018-01-29 22:07:15 +03:00
|
|
|
mysql-client \
|
|
|
|
default-libmysqlclient-dev \
|
2016-06-13 19:22:49 +03:00
|
|
|
swig \
|
2017-06-20 14:43:11 +03:00
|
|
|
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/*
|
2017-05-10 23:39:09 +03:00
|
|
|
|
2020-02-18 19:51:34 +03:00
|
|
|
# Install `file` and `libmagic` from the `buster` repositories for an up-to-date
|
2019-10-22 12:24:05 +03:00
|
|
|
# file-detection.
|
2020-02-18 19:51:34 +03:00
|
|
|
RUN apt-get update && apt-get -t buster install -y \
|
2020-04-07 19:11:25 +03:00
|
|
|
file \
|
|
|
|
libmagic-dev \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Install a recent libgit2-dev version...
|
|
|
|
RUN apt-get update && apt-get -t buster-backports install -y \
|
|
|
|
libgit2-dev \
|
2019-06-25 15:04:56 +03:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2020-04-07 19:11:25 +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
|
|
|
|
|
|
|
|
# Set the locale. This is mainly so that tests can write non-ascii files to
|
|
|
|
# disk.
|
|
|
|
ENV LANG en_US.UTF-8
|
|
|
|
ENV LC_ALL en_US.UTF-8
|
|
|
|
|
2015-09-18 14:59:08 +03:00
|
|
|
COPY . /code
|
2015-08-07 06:20:42 +03:00
|
|
|
WORKDIR /code
|
2015-09-18 14:59:08 +03:00
|
|
|
|
2019-10-22 12:24:05 +03:00
|
|
|
RUN groupadd -g ${GROUP_ID} olympia
|
|
|
|
RUN useradd -g ${GROUP_ID} -u ${USER_ID} -Md /deps/ olympia
|
|
|
|
|
|
|
|
# Create /deps/ and move ownership over to `olympia` user so that
|
|
|
|
# we can install things there
|
|
|
|
# Also run `chown` on `/code/` which technically doesn't change permissions
|
|
|
|
# on the host but ensures that the image knows about correct permissions.
|
|
|
|
RUN mkdir /deps/ && chown -R olympia:olympia /deps/ /code/
|
|
|
|
|
2016-05-17 15:07:33 +03:00
|
|
|
ENV PIP_BUILD=/deps/build/
|
|
|
|
ENV PIP_CACHE_DIR=/deps/cache/
|
|
|
|
ENV PIP_SRC=/deps/src/
|
2019-10-22 12:24:05 +03:00
|
|
|
|
|
|
|
# Allow us to install all dependencies to the `olympia` users
|
|
|
|
# home directory (which is `/deps/`)
|
|
|
|
ENV PIP_USER=true
|
|
|
|
ENV PYTHONUSERBASE=/deps
|
|
|
|
|
|
|
|
# Make sure that installed binaries are accessible
|
|
|
|
ENV PATH $PYTHONUSERBASE/bin:$PATH
|
|
|
|
|
2016-05-19 12:26:46 +03:00
|
|
|
ENV NPM_CONFIG_PREFIX=/deps/
|
2016-06-13 19:22:49 +03:00
|
|
|
ENV SWIG_FEATURES="-D__x86_64__"
|
2016-05-13 00:55:32 +03:00
|
|
|
|
2019-10-22 12:24:05 +03:00
|
|
|
# From now on run everything with the `olympia` user by default.
|
|
|
|
USER olympia
|
|
|
|
|
|
|
|
RUN ln -s /code/package.json /deps/package.json && \
|
2018-02-19 20:59:29 +03:00
|
|
|
make update_deps && \
|
|
|
|
rm -rf /deps/build/ /deps/cache/
|
2016-02-04 23:52:37 +03:00
|
|
|
|
2015-09-18 14:59:08 +03:00
|
|
|
# Preserve bash history across image updates.
|
|
|
|
# This works best when you link your local source code
|
|
|
|
# as a volume.
|
|
|
|
ENV HISTFILE /code/docker/artifacts/bash_history
|
2015-11-23 21:36:22 +03:00
|
|
|
|
2015-09-18 14:59:08 +03:00
|
|
|
# Configure bash history.
|
|
|
|
ENV HISTSIZE 50000
|
|
|
|
ENV HISTIGNORE ls:exit:"cd .."
|
2015-11-23 21:36:22 +03:00
|
|
|
|
2015-09-18 14:59:08 +03:00
|
|
|
# This prevents dupes but only in memory for the current session.
|
|
|
|
ENV HISTCONTROL erasedups
|
2015-09-29 11:38:50 +03:00
|
|
|
|
2016-05-19 12:26:46 +03:00
|
|
|
ENV CLEANCSS_BIN /deps/node_modules/.bin/cleancss
|
|
|
|
ENV LESS_BIN /deps/node_modules/.bin/lessc
|
|
|
|
ENV UGLIFY_BIN /deps/node_modules/.bin/uglifyjs
|
|
|
|
ENV ADDONS_LINTER_BIN /deps/node_modules/.bin/addons-linter
|