Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af5c58f
commit cfd2386
Showing
12 changed files
with
213 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,10 @@ venv | |
/static | ||
.env | ||
/media | ||
*.gz | ||
/locale | ||
/node_modules | ||
/bower_components | ||
Dockerfile | ||
/jsi18n | ||
docker/dockerfiles/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ALLOWED_HOSTS=* | ||
BROKER_URL=redis://redis:643 | ||
CACHE_URL=dummy:// | ||
REDIS_HELPFULVOTES_URL=foo | ||
REDIS_DEFAULT_URL=bar | ||
CELERY_ALWAYS_EAGER=True | ||
CSRF_COOKIE_SECURE=False | ||
DATABASE_URL=sqlite:// | ||
DOMAIN=localhost | ||
ES_URLS=elasticsearch:9200 | ||
SESSION_COOKIE_SECURE=False | ||
SITE_URL=http://localhost:8000 | ||
SECRET_KEY=secret | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
web: ./bin/run-prod.sh | ||
# Deis ignores Dockerfile entrypoint. | ||
web: /entrypoint.sh ./bin/run-prod.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
DOCKER_REPO=${DOCKER_REPO:-mozmeao/kitsune} | ||
GIT_SHA=${GIT_SHA:-auto} | ||
|
||
if [ $GIT_SHA == "auto" ]; | ||
then | ||
GIT_SHA_FULL=$(git rev-parse HEAD); | ||
GIT_SHA=${GIT_SHA_FULL:0:7}; | ||
fi | ||
|
||
for image in base staticfiles locales full-no-locales full; | ||
do | ||
docker build -t kitsune:${image}-latest \ | ||
-t ${DOCKER_REPO}:${image}-${GIT_SHA} \ | ||
-t ${DOCKER_REPO}:${image}-latest \ | ||
--cache-from ${DOCKER_REPO}:${image}-latest \ | ||
--cache-from kitsune:${image}-latest \ | ||
-f docker/dockerfiles/${image} \ | ||
--build-arg GIT_SHA=${GIT_SHA} . | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
source /venv/bin/activate | ||
|
||
exec $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
DOCKER_REPO=${DOCKER_REPO:-mozmeao/kitsune} | ||
|
||
for image in base staticfiles locales full-no-locales full; | ||
do | ||
docker pull ${DOCKER_REPO}:${image}-latest || true | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
DOCKER_REPO=${DOCKER_REPO:-mozmeao/kitsune} | ||
GIT_SHA=${GIT_SHA:-latest} | ||
|
||
if ! ([ "$DOCKER_USERNAME" ] || [ -f ~/.docker/config.json ]); | ||
then | ||
echo "No docker configuration, exiting." | ||
exit 0; | ||
fi | ||
|
||
if [ "$DOCKER_USERNAME" ]; | ||
then | ||
docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" | ||
fi | ||
|
||
for image in base staticfiles locales full-no-locales full; | ||
do | ||
docker push ${DOCKER_REPO}:${image}-${GIT_SHA} | ||
|
||
if [ $GIT_BRANCH == "master" ]; | ||
then | ||
docker push ${DOCKER_REPO}:${image}-latest | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM python:2-stretch | ||
|
||
WORKDIR /app | ||
|
||
ENV LANG=C.UTF-8 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN groupadd --gid 1000 kitsune && useradd -g kitsune --uid 1000 --shell /usr/sbin/nologin kitsune | ||
|
||
# Node is used in the staticfiles dockerfile but since this base image | ||
# is used for development get it installed here. | ||
RUN apt-get update && apt-get install apt-transport-https && \ | ||
echo "deb https://deb.nodesource.com/node_0.10 jessie main" >> /etc/apt/sources.list && \ | ||
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
gettext build-essential \ | ||
libxml2-dev libxslt1-dev zlib1g-dev git \ | ||
libjpeg-dev libffi-dev libssl-dev libxslt1.1 \ | ||
libmariadbclient-dev mariadb-client && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY ./requirements/ /app/requirements/ | ||
|
||
RUN bash -c '\ | ||
virtualenv /venv && \ | ||
source /venv/bin/activate && \ | ||
pip install --no-cache-dir --require-hashes -r requirements/default.txt && \ | ||
pip install --no-cache-dir --require-hashes -r requirements/test.txt && \ | ||
pip install --no-cache-dir --require-hashes -r requirements/dev.txt' | ||
|
||
ARG GIT_SHA=head | ||
ENV GIT_SHA ${GIT_SHA} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM kitsune:full-no-locales-latest | ||
|
||
USER root | ||
COPY --from=kitsune:locales-latest /app/locale /app/locale | ||
RUN chown kitsune.kitsune -R /app/locale | ||
USER kitsune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM python:2-slim-stretch | ||
|
||
WORKDIR /app | ||
|
||
EXPOSE 8000 | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
ENV LANG=C.UTF-8 | ||
ENV PYTHONDONTWRITEBYTECODE=1 | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
libmariadbclient18 optipng \ | ||
libxslt1.1 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN groupadd --gid 1000 kitsune && useradd -g kitsune --uid 1000 --shell /usr/sbin/nologin kitsune | ||
|
||
COPY docker/bin/entrypoint.sh /entrypoint.sh | ||
|
||
COPY --from=kitsune:base-latest /venv /venv | ||
COPY --from=kitsune:staticfiles-latest /app/static /app/static | ||
|
||
COPY . . | ||
|
||
RUN chown kitsune.kitsune -R /app | ||
USER kitsune | ||
|
||
ARG GIT_SHA=head | ||
ENV GIT_SHA ${GIT_SHA} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM python:2-stretch | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends gettext | ||
|
||
COPY --from=kitsune:base-latest /venv /venv | ||
|
||
COPY . . | ||
|
||
ARG LOCALE_ENV=master | ||
RUN bash -c '\ | ||
mkdir locale && \ | ||
curl -s -L https://github.com/mozilla-l10n/sumo-l10n/archive/${LOCALE_ENV}.tar.gz | \ | ||
tar xz --strip-components=1 -C locale' | ||
|
||
RUN bash -c '\ | ||
source /venv/bin/activate && \ | ||
./scripts/compile-linted-mo.sh && \ | ||
find ./locale ! -name '*.mo' -type f -delete' | ||
|
||
ARG GIT_SHA=head | ||
ENV GIT_SHA ${GIT_SHA} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM python:2-stretch | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get install apt-transport-https && \ | ||
echo "deb https://deb.nodesource.com/node_0.10 jessie main" >> /etc/apt/sources.list && \ | ||
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \ | ||
apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
nodejs=0.10.48-1nodesource1~jessie1 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY ./package.json /app/package.json | ||
COPY ./bower.json /app/bower.json | ||
|
||
RUN npm install | ||
|
||
RUN ./node_modules/.bin/bower install --allow-root | ||
|
||
COPY --from=kitsune:base-latest /venv /venv | ||
|
||
COPY . . | ||
|
||
RUN bash -c '\ | ||
source /venv/bin/activate && \ | ||
cp .env-build .env && \ | ||
./manage.py nunjucks_precompile && \ | ||
./manage.py compilejsi18n && \ | ||
./manage.py collectstatic --noinput' | ||
|
||
ARG GIT_SHA=head | ||
ENV GIT_SHA ${GIT_SHA} |