├── .travis.yml ├── 2.7 ├── Dockerfile └── onbuild │ └── Dockerfile ├── 3.4 ├── Dockerfile └── onbuild │ └── Dockerfile ├── LICENSE ├── README.md ├── generate-stackbrew-library.sh └── update.sh /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | services: docker 3 | 4 | env: 5 | - PY_VERSION=3.4 6 | - PY_VERSION=2.7 7 | 8 | install: 9 | - git clone https://github.com/docker-library/official-images.git ~/official-images 10 | 11 | before_script: 12 | - env | sort 13 | - cd "$PY_VERSION" 14 | - image="django:python$PY_VERSION" 15 | 16 | script: 17 | - docker build -t "$image" . 18 | - ~/official-images/test/run.sh "$image" 19 | - docker build -t "$image-onbuild" onbuild 20 | 21 | after_script: 22 | - docker images 23 | 24 | # vim:set et ts=2 sw=2: 25 | -------------------------------------------------------------------------------- /2.7/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7-slim 2 | 3 | RUN apt-get update && apt-get install -y \ 4 | gcc \ 5 | gettext \ 6 | mysql-client libmysqlclient-dev \ 7 | postgresql-client libpq-dev \ 8 | sqlite3 \ 9 | --no-install-recommends && rm -rf /var/lib/apt/lists/* 10 | 11 | ENV DJANGO_VERSION 1.10.4 12 | 13 | RUN pip install mysqlclient psycopg2 django=="$DJANGO_VERSION" 14 | -------------------------------------------------------------------------------- /2.7/onbuild/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:2.7 2 | 3 | RUN mkdir -p /usr/src/app 4 | WORKDIR /usr/src/app 5 | 6 | ONBUILD COPY requirements.txt /usr/src/app/ 7 | ONBUILD RUN pip install --no-cache-dir -r requirements.txt 8 | 9 | ONBUILD COPY . /usr/src/app 10 | 11 | RUN apt-get update && apt-get install -y \ 12 | gcc \ 13 | gettext \ 14 | mysql-client libmysqlclient-dev \ 15 | postgresql-client libpq-dev \ 16 | sqlite3 \ 17 | --no-install-recommends && rm -rf /var/lib/apt/lists/* 18 | 19 | EXPOSE 8000 20 | CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] 21 | -------------------------------------------------------------------------------- /3.4/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.4-slim 2 | 3 | RUN apt-get update && apt-get install -y \ 4 | gcc \ 5 | gettext \ 6 | mysql-client libmysqlclient-dev \ 7 | postgresql-client libpq-dev \ 8 | sqlite3 \ 9 | --no-install-recommends && rm -rf /var/lib/apt/lists/* 10 | 11 | ENV DJANGO_VERSION 1.10.4 12 | 13 | RUN pip install mysqlclient psycopg2 django=="$DJANGO_VERSION" 14 | -------------------------------------------------------------------------------- /3.4/onbuild/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM python:3.4 8 | 9 | RUN mkdir -p /usr/src/app 10 | WORKDIR /usr/src/app 11 | 12 | ONBUILD COPY requirements.txt /usr/src/app/ 13 | ONBUILD RUN pip install --no-cache-dir -r requirements.txt 14 | 15 | ONBUILD COPY . /usr/src/app 16 | 17 | RUN apt-get update && apt-get install -y \ 18 | gcc \ 19 | gettext \ 20 | mysql-client libmysqlclient-dev \ 21 | postgresql-client libpq-dev \ 22 | sqlite3 \ 23 | --no-install-recommends && rm -rf /var/lib/apt/lists/* 24 | 25 | EXPOSE 8000 26 | CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) Docker, Inc. and individual contributors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of Django nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | 3 | This image is officially deprecated in favor of [the standard `python` image](https://hub.docker.com/_/python/), and will receive no further updates after 2016-12-31 (Dec 31, 2016). Please adjust your usage accordingly. 4 | 5 | For most usages of this image, it was already not bringing in `django` from this image, but actually from your project's `requirements.txt`, so the only "value" being added here was the pre-installing of `mysql-client`, `postgresql-client`, and `sqlite3` for various uses of the `django` framework. 6 | 7 | For example, a `Dockerfile` similar to the following would be a good starting point for a Django project using PostgreSQL: 8 | 9 | ```dockerfile 10 | FROM python:3.4 11 | 12 | RUN apt-get update \ 13 | && apt-get install -y --no-install-recommends \ 14 | postgresql-client \ 15 | && rm -rf /var/lib/apt/lists/* 16 | 17 | WORKDIR /usr/src/app 18 | COPY requirements.txt ./ 19 | RUN pip install -r requirements.txt 20 | COPY . . 21 | 22 | EXPOSE 8000 23 | CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] 24 | ``` 25 | 26 | # About this Repo 27 | 28 | This is the Git repo of the Docker [official image](https://docs.docker.com/docker-hub/official_repos/) for [django](https://registry.hub.docker.com/_/django/). See [the Docker Hub page](https://registry.hub.docker.com/_/django/) for the full readme on how to use this Docker image and for information regarding contributing and issues. 29 | 30 | The full readme is generated over in [docker-library/docs](https://github.com/docker-library/docs), specifically in [docker-library/docs/django](https://github.com/docker-library/docs/tree/master/django). 31 | 32 | See a change merged here that doesn't show up on the Docker Hub yet? Check [the "library/django" manifest file in the docker-library/official-images repo](https://github.com/docker-library/official-images/blob/master/library/django), especially [PRs with the "library/django" label on that repo](https://github.com/docker-library/official-images/labels/library%2Fdjango). For more information about the official images process, see the [docker-library/official-images readme](https://github.com/docker-library/official-images/blob/master/README.md). 33 | 34 | --- 35 | 36 | - [Travis CI: 37 | ![build status badge](https://img.shields.io/travis/docker-library/django/master.svg)](https://travis-ci.org/docker-library/django/branches) 38 | 39 | 40 | -------------------------------------------------------------------------------- /generate-stackbrew-library.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | latestPythonMajor='3' 5 | 6 | self="$(basename "$BASH_SOURCE")" 7 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 8 | 9 | pyVersions=( */ ) 10 | pyVersions=( "${pyVersions[@]%/}" ) 11 | 12 | # sort version numbers with highest first 13 | IFS=$'\n'; pyVersions=( $(echo "${pyVersions[*]}" | sort -rV) ); unset IFS 14 | 15 | # get the most recent commit which modified any of "$@" 16 | fileCommit() { 17 | git log -1 --format='format:%H' HEAD -- "$@" 18 | } 19 | 20 | # get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile" 21 | dirCommit() { 22 | local dir="$1"; shift 23 | ( 24 | cd "$dir" 25 | fileCommit \ 26 | Dockerfile \ 27 | $(git show HEAD:./Dockerfile | awk ' 28 | toupper($1) == "COPY" { 29 | for (i = 2; i < NF; i++) { 30 | print $i 31 | } 32 | } 33 | ') 34 | ) 35 | } 36 | 37 | cat <<-EOH 38 | # this file is generated via https://github.com/docker-library/django/blob/$(fileCommit "$self")/$self 39 | 40 | Maintainers: Tianon Gravi (@tianon), 41 | Joseph Ferguson (@yosifkit) 42 | GitRepo: https://github.com/docker-library/django.git 43 | EOH 44 | 45 | # prints "$2$1$3$1...$N" 46 | join() { 47 | local sep="$1"; shift 48 | local out; printf -v out "${sep//%/%%}%s" "$@" 49 | echo "${out#$sep}" 50 | } 51 | 52 | for pyVersion in "${pyVersions[@]}"; do 53 | pyMajor="${pyVersion%.*}" 54 | 55 | commit="$(dirCommit "$pyVersion")" 56 | 57 | fullVersion="$(git show "$commit":"$pyVersion/Dockerfile" | awk '$1 == "ENV" && $2 == "DJANGO_VERSION" { print $3; exit }')" 58 | 59 | versionAliases=() 60 | while [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do 61 | versionAliases+=( $fullVersion ) 62 | fullVersion="${fullVersion%[.-]*}" 63 | done 64 | versionAliases+=( 65 | $fullVersion 66 | latest 67 | ) 68 | 69 | variant="python$pyMajor" 70 | 71 | variantAliases=( "${versionAliases[@]/%/-$variant}" ) 72 | variantAliases=( "${variantAliases[@]//latest-/}" ) 73 | 74 | if [ "$pyMajor" = "$latestPythonMajor" ]; then 75 | variantAliases+=( "${versionAliases[@]}" ) 76 | fi 77 | 78 | echo 79 | cat <<-EOE 80 | Tags: $(join ', ' "${variantAliases[@]}") 81 | GitCommit: $commit 82 | Directory: $pyVersion 83 | EOE 84 | 85 | for subVariant in onbuild; do 86 | [ -f "$pyVersion/$subVariant/Dockerfile" ] || continue 87 | 88 | commit="$(dirCommit "$pyVersion/$subVariant")" 89 | 90 | variantAliases=( "$variant-$subVariant" ) 91 | if [ "$pyMajor" = "$latestPythonMajor" ]; then 92 | variantAliases+=( "$subVariant" ) 93 | fi 94 | 95 | echo 96 | cat <<-EOE 97 | Tags: $(join ', ' "${variantAliases[@]}") 98 | GitCommit: $commit 99 | Directory: $pyVersion/$subVariant 100 | EOE 101 | done 102 | done 103 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | 4 | cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 5 | 6 | versions=( "$@" ) 7 | if [ ${#versions[@]} -eq 0 ]; then 8 | versions=( */ ) 9 | fi 10 | versions=( "${versions[@]%/}" ) 11 | 12 | #current="$(curl -sSL 'https://pypi.python.org/pypi/django/json' | awk -F '"' '$2 == "version" { print $4 }')" # UGH "1.8a1" 13 | current="$(curl -sSL 'https://pypi.python.org/pypi/django/json' | grep '^ "[0-9].*\[$' | cut -d '"' -f2 | grep -vE '[0-9]([abc]|rc)[0-9]' | sort -V | tail -1)" # TODO remove this heinous thing in favor of something better since it just filters out "1.8a1" and "1.8b1" 14 | 15 | travisEnv= 16 | for version in "${versions[@]}"; do 17 | ( set -x; sed -ri 's/^(ENV DJANGO_VERSION) .*/\1 '"$current"'/' "$version/Dockerfile" ) 18 | 19 | pythonOnbuildDockerfile="https://raw.githubusercontent.com/docker-library/python/master/$version/onbuild/Dockerfile" 20 | ( set -x; curl -sSL "$pythonOnbuildDockerfile" -o "$version/onbuild/Dockerfile" ) 21 | { 22 | echo 23 | # see http://stackoverflow.com/a/12776899 (line continuations eat our lunch) 24 | sed -n ': begin; /\\$/ { N; b begin }; /apt-get/ p' "$version/Dockerfile" 25 | echo 26 | echo 'EXPOSE 8000' 27 | echo 'CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]' 28 | } >> "$version/onbuild/Dockerfile" 29 | 30 | from="$(awk '$1 == "FROM" { print $2 }' "$version/onbuild/Dockerfile")" 31 | ( set -x; sed -ri 's/^(FROM) .*/\1 '"$from"'-slim/' "$version/Dockerfile" ) 32 | 33 | travisEnv='\n - PY_VERSION='"$version$travisEnv" 34 | done 35 | 36 | travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)" 37 | echo "$travis" > .travis.yml 38 | --------------------------------------------------------------------------------