mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 09:36:52 +03:00
Move to the python:alpine docker image (#1482)
* Move to the python:alpine docker image - Switch the base images for local and production to alpine - Install extra dependencies for psycopg2, Pillow and cffi - Change shebang for shell scripts to use sh instead of bash * Move to the python:alpine docker image - Migrate group and user creation to Alpine syntax * Move to the python:alpine docker image - Remove `function` keyword, unsupported in shell * Upgrade various places to the latest Python 3.6 * Test support for translations * Add gettext library, required for translations support * Add locale folder for translations support with README documenting it * Update Changelog * Tweak command to test translations support
This commit is contained in:
parent
f4cadeec97
commit
0164c330b3
|
@ -19,3 +19,6 @@ docker-compose -f local.yml run django python manage.py test
|
||||||
|
|
||||||
# return non-zero status code if there are migrations that have not been created
|
# return non-zero status code if there are migrations that have not been created
|
||||||
docker-compose -f local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
|
docker-compose -f local.yml run django python manage.py makemigrations --dry-run --check || { echo "ERROR: there were changes in the models, but migration listed above have not been created and are not saved in version control"; exit 1; }
|
||||||
|
|
||||||
|
# Test support for translations
|
||||||
|
docker-compose -f local.yml run --rm django python manage.py makemessages
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
FROM python:3.6
|
FROM python:3.6-alpine
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
|
RUN apk update \
|
||||||
|
# psycopg2 dependencies
|
||||||
|
&& apk add --virtual build-deps gcc python3-dev musl-dev \
|
||||||
|
&& apk add postgresql-dev \
|
||||||
|
# Pillow dependencies
|
||||||
|
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
|
||||||
|
# CFFI dependencies
|
||||||
|
&& apk add libffi-dev openssl-dev py-cffi \
|
||||||
|
# Translations dependencies
|
||||||
|
&& apk add gettext
|
||||||
|
|
||||||
# Requirements have to be pulled and installed here, otherwise caching won't work
|
# Requirements have to be pulled and installed here, otherwise caching won't work
|
||||||
COPY ./requirements /requirements
|
COPY ./requirements /requirements
|
||||||
RUN pip install -r /requirements/local.txt
|
RUN pip install -r /requirements/local.txt
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
|
@ -1,9 +1,18 @@
|
||||||
FROM python:3.6
|
FROM python:3.6-alpine
|
||||||
|
|
||||||
ENV PYTHONUNBUFFERED 1
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
RUN groupadd -r django \
|
RUN apk update \
|
||||||
&& useradd -r -g django django
|
# psycopg2 dependencies
|
||||||
|
&& apk add --virtual build-deps gcc python3-dev musl-dev \
|
||||||
|
&& apk add postgresql-dev \
|
||||||
|
# Pillow dependencies
|
||||||
|
&& apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \
|
||||||
|
# CFFI dependencies
|
||||||
|
&& apk add libffi-dev openssl-dev py-cffi
|
||||||
|
|
||||||
|
RUN addgroup -S django \
|
||||||
|
&& adduser -S -G django django
|
||||||
|
|
||||||
# Requirements have to be pulled and installed here, otherwise caching won't work
|
# Requirements have to be pulled and installed here, otherwise caching won't work
|
||||||
COPY ./requirements /requirements
|
COPY ./requirements /requirements
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
@ -25,7 +25,7 @@ export DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@postgres:5432/$
|
||||||
export CELERY_BROKER_URL=$REDIS_URL/0
|
export CELERY_BROKER_URL=$REDIS_URL/0
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
function postgres_ready(){
|
postgres_ready() {
|
||||||
python << END
|
python << END
|
||||||
import sys
|
import sys
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/sh
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
6
{{cookiecutter.project_slug}}/locale/README.rst
Normal file
6
{{cookiecutter.project_slug}}/locale/README.rst
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Translations
|
||||||
|
============
|
||||||
|
|
||||||
|
Translations will be placed in this folder when running::
|
||||||
|
|
||||||
|
python manage.py makemessages
|
Loading…
Reference in New Issue
Block a user