2022-08-17 20:25:13 +03:00
|
|
|
FROM python:3.10-slim-buster
|
2014-10-01 15:44:44 +04:00
|
|
|
|
2023-03-23 17:46:56 +03:00
|
|
|
# Should change it to use ARG instead of ENV for OLYMPIA_UID/OLYMPIA_GID
|
|
|
|
# once the jenkins server is upgraded to support docker >= v1.9.0
|
|
|
|
ENV OLYMPIA_UID=9500 \
|
|
|
|
OLYMPIA_GID=9500
|
|
|
|
RUN groupadd -g ${OLYMPIA_GID} olympia && useradd -u ${OLYMPIA_UID} -g ${OLYMPIA_GID} -s /sbin/nologin -d /data/olympia olympia
|
2019-08-29 14:10:25 +03:00
|
|
|
|
2020-11-06 14:20:43 +03:00
|
|
|
# Add support for https apt repos and gpg signed repos
|
2018-01-29 22:07:15 +03:00
|
|
|
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/*
|
2020-11-06 14:20:43 +03:00
|
|
|
# Add keys and repos for node and mysql
|
|
|
|
COPY docker/*.gpg.key /etc/pki/gpg/
|
|
|
|
RUN APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn \
|
|
|
|
apt-key add /etc/pki/gpg/nodesource.gpg.key \
|
|
|
|
&& APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn \
|
|
|
|
apt-key add /etc/pki/gpg/mysql.gpg.key
|
|
|
|
COPY docker/*.list /etc/apt/sources.list.d/
|
2017-07-28 23:51:18 +03:00
|
|
|
|
2020-11-06 14:20:43 +03:00
|
|
|
# Allow scripts to detect we're running in our own container and install
|
|
|
|
# packages.
|
|
|
|
RUN touch /addons-server-docker-container \
|
|
|
|
&& apt-get update && apt-get -t buster 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 \
|
|
|
|
nodejs \
|
2015-11-23 21:36:22 +03:00
|
|
|
# Git, because we're using git-checkout dependencies
|
|
|
|
git \
|
2020-11-06 14:20:43 +03:00
|
|
|
# Dependencies for mysql-python (from mysql apt repo, not debian)
|
|
|
|
mysql-client \
|
|
|
|
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 \
|
2018-01-29 22:07:15 +03:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2017-05-10 23:39:09 +03:00
|
|
|
|
2023-03-23 17:46:56 +03:00
|
|
|
# Add our custom mime types (required for for ts/json/md files)
|
2020-05-12 14:12:35 +03:00
|
|
|
ADD docker/etc/mime.types /etc/mime.types
|
2020-04-08 12:54:04 +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
|
|
|
|
|
2023-03-23 17:46:56 +03:00
|
|
|
ENV HOME /data/olympia
|
|
|
|
|
|
|
|
# version.json is overwritten by CircleCI (see circle.yml).
|
|
|
|
# The pipeline v2 standard requires the existence of /app/version.json
|
|
|
|
# inside the docker image, thus it's copied there.
|
|
|
|
COPY version.json /app/version.json
|
|
|
|
COPY --chown=olympia:olympia . ${HOME}
|
|
|
|
WORKDIR ${HOME}
|
|
|
|
|
|
|
|
# Set up directories and links that we'll need later, before switching to the
|
|
|
|
# olympia user.
|
|
|
|
RUN mkdir /deps \
|
|
|
|
&& chown olympia:olympia /deps \
|
|
|
|
&& rm -rf ${HOME}/src/olympia.egg-info \
|
|
|
|
&& mkdir ${HOME}/src/olympia.egg-info \
|
|
|
|
&& chown olympia:olympia ${HOME}/src/olympia.egg-info \
|
|
|
|
# For backwards-compatibility purposes, set up links to uwsgi. Note that
|
|
|
|
# the target doesn't exist yet at this point, but it will later.
|
|
|
|
&& ln -s /deps/bin/uwsgi /usr/bin/uwsgi \
|
|
|
|
&& ln -s /usr/bin/uwsgi /usr/sbin/uwsgi
|
|
|
|
|
|
|
|
USER olympia:olympia
|
|
|
|
|
|
|
|
# Install all dependencies, and add symlink for old uwsgi binary paths
|
|
|
|
ENV PIP_USER=true
|
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
|
|
|
ENV PYTHONUSERBASE=/deps
|
|
|
|
ENV PATH $PYTHONUSERBASE/bin:$PATH
|
2016-05-19 12:26:46 +03:00
|
|
|
ENV NPM_CONFIG_PREFIX=/deps/
|
2023-03-23 17:46:56 +03:00
|
|
|
RUN ln -s ${HOME}/package.json /deps/package.json \
|
|
|
|
&& ln -s ${HOME}/package-lock.json /deps/package-lock.json \
|
|
|
|
&& make update_deps
|
|
|
|
|
|
|
|
WORKDIR ${HOME}
|
|
|
|
|
|
|
|
# Build locales, assets, build id.
|
|
|
|
RUN echo "from olympia.lib.settings_base import *\n" \
|
|
|
|
> settings_local.py && DJANGO_SETTINGS_MODULE='settings_local' locale/compile-mo.sh locale \
|
|
|
|
&& DJANGO_SETTINGS_MODULE='settings_local' python manage.py compress_assets \
|
|
|
|
&& DJANGO_SETTINGS_MODULE='settings_local' python manage.py generate_jsi18n_files \
|
|
|
|
&& DJANGO_SETTINGS_MODULE='settings_local' python manage.py collectstatic --noinput \
|
|
|
|
&& npm prune --production \
|
|
|
|
&& ./scripts/generate_build.py > build.py \
|
|
|
|
&& rm -f settings_local.py settings_local.pyc
|