Skip to content

Commit

Permalink
Merge 6627707 into a2b53a9
Browse files Browse the repository at this point in the history
  • Loading branch information
phlax committed Apr 9, 2018
2 parents a2b53a9 + 6627707 commit 18d271f
Show file tree
Hide file tree
Showing 18 changed files with 297 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docker/base/Dockerfile
@@ -0,0 +1,16 @@
# translate/pootle:base
#
# VERSION 0.0.1

FROM translate/pootle:root

MAINTAINER Ryan Northey <ryan@synca.io>

ENV POOTLE_LOG_DIR="$INSTALL_DIR/var/logs"

COPY ./install-base /usr/local/bin
RUN ./usr/local/bin/install-base
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
EXPOSE 8000
12 changes: 12 additions & 0 deletions docker/base/entrypoint.sh
@@ -0,0 +1,12 @@
#!/bin/bash

# Add local user
# Either use the LOCAL_USER_ID if passed in at runtime or
# fallback

USER_ID=${LOCAL_USER_ID:$UID}

echo "Starting with UID : $USER_ID"
usermod -o -u $USER_ID pootle
export HOME=/home/pootle
exec gosu pootle "$@"
13 changes: 13 additions & 0 deletions docker/base/install-base
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

apt-get update -qq
apt-get install \
-y -qq \
--no-install-recommends \
gettext \
gosu \
make \
python-dev
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
17 changes: 17 additions & 0 deletions docker/build/Dockerfile
@@ -0,0 +1,17 @@
# translate/pootle:base
#
# VERSION 0.0.1

FROM translate/pootle:root

MAINTAINER Ryan Northey <ryan@synca.io>

COPY ./install-build /usr/local/bin
RUN ./usr/local/bin/install-build

USER pootle

COPY ./install-virtualenv /usr/local/bin
RUN ./usr/local/bin/install-virtualenv

USER root
18 changes: 18 additions & 0 deletions docker/build/install-build
@@ -0,0 +1,18 @@
#!/bin/bash

set -e

apt-get update -qq
apt-get install -y -qq \
build-essential \
coreutils \
libjpeg-dev \
libfreetype6-dev \
liblcms2-dev \
libtiff5-dev \
libwebp-dev \
libxml2-dev \
libxslt-dev \
python-dev \
zlib1g-dev
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
38 changes: 38 additions & 0 deletions docker/build/install-virtualenv
@@ -0,0 +1,38 @@
#!/bin/bash

set -e

INSTALL_DIR=$(readlink -f --canonicalize $(eval echo $INSTALL_DIR))

mkdir -p $INSTALL_DIR

cd $INSTALL_DIR

function get_requirement () {
curl -sO https://raw.githubusercontent.com/translate/pootle/master/requirements/$1.txt
}

mkdir requirements
cd requirements
declare -a requirements=("_es_5" "base" "dev" "tests" "_docs" "_lint")
for i in "${requirements[@]}"
do
get_requirement "$i"
done
cd ..

virtualenv .
. bin/activate \
&& pip install --no-cache-dir -qr requirements/dev.txt \
&& pip install --no-cache-dir -qr requirements/_es_5.txt \
&& pip install --no-cache-dir -q \
codecov==2.0.15 \
coverage==4.5.1 \
coveralls==1.3.0 \
&& pyclean .

cd $INSTALL_DIR
curl -s -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
. ~/.nvm/nvm.sh

nvm install node
32 changes: 32 additions & 0 deletions docker/dev-mariadb/Dockerfile
@@ -0,0 +1,32 @@
# translate/pootle:dev-mariadb
#
# VERSION 0.0.1

# Build stage
FROM translate/pootle:build

COPY ./settings.conf /tmp/
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
&& apt-get update -qq \
&& apt-get install -qq -y \
--no-install-recommends \
libmariadbclient-dev-compat
USER pootle
RUN bash -c " \
cd "$INSTALL_DIR" \
&& . bin/activate \
&& pip install -q \
MySQL-python \
&& cp /tmp/settings.conf \
/home/pootle/pootle_env/pootle.conf"

# Mariadb dev
FROM translate/pootle:base

ENV POOTLE_ENV=mariadb
RUN apt-get update -qq \
&& apt-get install -qq -y \
--no-install-recommends \
libmariadbclient18 \
mariadb-client
COPY --chown=pootle:pootle --from=0 /home/pootle/ /home/pootle
19 changes: 19 additions & 0 deletions docker/dev-mariadb/settings.conf
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-

SECRET_KEY = 'SECRETKEY'
ALLOWED_HOSTS = [
'127.0.0.1',
'localhost',
#'${your_server}',
]

DATABASES['default']['ENGINE'] = 'django.db.backends.mysql'
DATABASES['default']['NAME'] = 'pootle'
DATABASES['default']['USER'] = 'travis'
DATABASES['default']['TEST'] = dict(
COLLATION='utf8_general_ci',
NAME='',
CHARSET='utf8')
DATABASES['default']['OPTIONS'] = {
'init_command': "SET sql_mode='STRICT_ALL_TABLES'"}
4 changes: 4 additions & 0 deletions docker/dev-mariadb/webapp.env
@@ -0,0 +1,4 @@
SECRET_KEY=insert_random_key
DJANGO_DEV=True
DJANGO_DEBUG=True
SITE_URL=http://localhost:8000
32 changes: 32 additions & 0 deletions docker/dev-postgres/Dockerfile
@@ -0,0 +1,32 @@
# translate/pootle:dev-postgres
#
# VERSION 0.0.1

# Build stage
FROM translate/pootle:build

COPY ./settings.conf /tmp/
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
&& apt-get update -qq \
&& apt-get install -qq -y \
--no-install-recommends \
libpq-dev
USER pootle
RUN bash -c " \
cd "$INSTALL_DIR" \
&& . bin/activate \
&& pip install -q \
psycopg2-binary \
&& cp /tmp/settings.conf \
/home/pootle/pootle_env/pootle.conf"

# Postgres dev
FROM translate/pootle:base

ENV POOTLE_ENV=postgres
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
&& apt-get update -qq \
&& apt-get install -qq -y \
--no-install-recommends \
postgresql-client
COPY --chown=pootle:pootle --from=0 /home/pootle/ /home/pootle
12 changes: 12 additions & 0 deletions docker/dev-postgres/settings.conf
@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-

SECRET_KEY = 'SECRETKEY'
ALLOWED_HOSTS = [
'127.0.0.1',
'localhost',
#'${your_server}',
]

DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql'
DATABASES['default']['NAME'] = 'pootle'
DATABASES['default']['USER'] = 'postgres'
4 changes: 4 additions & 0 deletions docker/dev-postgres/webapp.env
@@ -0,0 +1,4 @@
SECRET_KEY=insert_random_key
DJANGO_DEV=True
DJANGO_DEBUG=True
SITE_URL=http://localhost:8000
19 changes: 19 additions & 0 deletions docker/dev-sqlite/Dockerfile
@@ -0,0 +1,19 @@
# translate/pootle:dev-sqlite
#
# VERSION 0.0.1

# Build stage
FROM translate/pootle:build

COPY ./settings.conf /tmp/
RUN cp /tmp/settings.conf /home/pootle/pootle_env/pootle.conf

# Sqlite dev
FROM translate/pootle:base

ENV POOTLE_ENV=sqlite
RUN apt-get update -qq \
&& apt-get install -qq -y \
--no-install-recommends \
sqlite3
COPY --chown=pootle:pootle --from=0 /home/pootle/ /home/pootle
8 changes: 8 additions & 0 deletions docker/dev-sqlite/settings.conf
@@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-

SECRET_KEY = 'SECRETKEY'
ALLOWED_HOSTS = [
'127.0.0.1',
'localhost',
#'${your_server}',
]
4 changes: 4 additions & 0 deletions docker/dev-sqlite/webapp.env
@@ -0,0 +1,4 @@
SECRET_KEY=insert_random_key
DJANGO_DEV=True
DJANGO_DEBUG=True
SITE_URL=http://localhost:8000
16 changes: 16 additions & 0 deletions docker/root/Dockerfile
@@ -0,0 +1,16 @@
# translate/pootle:root
#
# VERSION 0.0.1

FROM debian:stretch-slim

MAINTAINER Ryan Northey <ryan@synca.io>

ENV DEBIAN_FRONTEND=noninteractive \
INSTALL_DIR=~/pootle_env \
POOTLE_PKG='-e git://github.com/translate/pootle#egg=pootle' \
POOTLE_LOG_DIR="$INSTALL_DIR/var/logs"

COPY ./install-root /usr/local/bin
COPY ./no-apt-cache /etc/apt/apt.conf.d/02nocache
RUN ./usr/local/bin/install-root
31 changes: 31 additions & 0 deletions docker/root/install-root
@@ -0,0 +1,31 @@
#!/bin/bash

# Installs/configures the packages used in all images
# and creates the pootle user

set -e

apt-get update -qq
apt-get install \
-y \
-qq \
--no-install-recommends \
curl \
git \
locales \
python-pip \
sudo
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
rm -rf /var/cache/apt/archives
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
update-locale LANG=en_US.UTF-8
pip install --no-cache-dir -q virtualenv
groupadd -r pootle
useradd \
-m \
-d /home/pootle \
-k /etc/skel \
-s /bin/bash \
-g pootle \
pootle
2 changes: 2 additions & 0 deletions docker/root/no-apt-cache
@@ -0,0 +1,2 @@
Dir::Cache "";
Dir::Cache::archives "";

0 comments on commit 18d271f

Please sign in to comment.