Full Code of docker-library/django for AI

master daff730405c3 cached
9 files
9.7 KB
3.1k tokens
1 requests
Download .txt
Repository: docker-library/django
Branch: master
Commit: daff730405c3
Files: 9
Total size: 9.7 KB

Directory structure:
gitextract_1xzrnk5n/

├── .travis.yml
├── 2.7/
│   ├── Dockerfile
│   └── onbuild/
│       └── Dockerfile
├── 3.4/
│   ├── Dockerfile
│   └── onbuild/
│       └── Dockerfile
├── LICENSE
├── README.md
├── generate-stackbrew-library.sh
└── update.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: .travis.yml
================================================
language: bash
services: docker

env:
  - PY_VERSION=3.4
  - PY_VERSION=2.7

install:
  - git clone https://github.com/docker-library/official-images.git ~/official-images

before_script:
  - env | sort
  - cd "$PY_VERSION"
  - image="django:python$PY_VERSION"

script:
  - docker build -t "$image" .
  - ~/official-images/test/run.sh "$image"
  - docker build -t "$image-onbuild" onbuild

after_script:
  - docker images

# vim:set et ts=2 sw=2:


================================================
FILE: 2.7/Dockerfile
================================================
FROM python:2.7-slim

RUN apt-get update && apt-get install -y \
		gcc \
		gettext \
		mysql-client libmysqlclient-dev \
		postgresql-client libpq-dev \
		sqlite3 \
	--no-install-recommends && rm -rf /var/lib/apt/lists/*

ENV DJANGO_VERSION 1.10.4

RUN pip install mysqlclient psycopg2 django=="$DJANGO_VERSION"


================================================
FILE: 2.7/onbuild/Dockerfile
================================================
FROM python:2.7

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD COPY requirements.txt /usr/src/app/
ONBUILD RUN pip install --no-cache-dir -r requirements.txt

ONBUILD COPY . /usr/src/app

RUN apt-get update && apt-get install -y \
		gcc \
		gettext \
		mysql-client libmysqlclient-dev \
		postgresql-client libpq-dev \
		sqlite3 \
	--no-install-recommends && rm -rf /var/lib/apt/lists/*

EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]


================================================
FILE: 3.4/Dockerfile
================================================
FROM python:3.4-slim

RUN apt-get update && apt-get install -y \
		gcc \
		gettext \
		mysql-client libmysqlclient-dev \
		postgresql-client libpq-dev \
		sqlite3 \
	--no-install-recommends && rm -rf /var/lib/apt/lists/*

ENV DJANGO_VERSION 1.10.4

RUN pip install mysqlclient psycopg2 django=="$DJANGO_VERSION"


================================================
FILE: 3.4/onbuild/Dockerfile
================================================
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM python:3.4

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

ONBUILD COPY requirements.txt /usr/src/app/
ONBUILD RUN pip install --no-cache-dir -r requirements.txt

ONBUILD COPY . /usr/src/app

RUN apt-get update && apt-get install -y \
		gcc \
		gettext \
		mysql-client libmysqlclient-dev \
		postgresql-client libpq-dev \
		sqlite3 \
	--no-install-recommends && rm -rf /var/lib/apt/lists/*

EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]


================================================
FILE: LICENSE
================================================
Copyright (c) Docker, Inc. and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

    3. Neither the name of Django nor the names of its contributors may be used
       to endorse or promote products derived from this software without
       specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


================================================
FILE: README.md
================================================
# DEPRECATED

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.

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.

For example, a `Dockerfile` similar to the following would be a good starting point for a Django project using PostgreSQL:

```dockerfile
FROM python:3.4

RUN apt-get update \
	&& apt-get install -y --no-install-recommends \
		postgresql-client \
	&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY . .

EXPOSE 8000
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
```

# About this Repo

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.

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).

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).

---

-	[Travis CI:  
	![build status badge](https://img.shields.io/travis/docker-library/django/master.svg)](https://travis-ci.org/docker-library/django/branches)

<!-- THIS FILE IS GENERATED BY https://github.com/docker-library/docs/blob/master/generate-repo-stub-readme.sh -->


================================================
FILE: generate-stackbrew-library.sh
================================================
#!/bin/bash
set -eu

latestPythonMajor='3'

self="$(basename "$BASH_SOURCE")"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"

pyVersions=( */ )
pyVersions=( "${pyVersions[@]%/}" )

# sort version numbers with highest first
IFS=$'\n'; pyVersions=( $(echo "${pyVersions[*]}" | sort -rV) ); unset IFS

# get the most recent commit which modified any of "$@"
fileCommit() {
	git log -1 --format='format:%H' HEAD -- "$@"
}

# get the most recent commit which modified "$1/Dockerfile" or any file COPY'd from "$1/Dockerfile"
dirCommit() {
	local dir="$1"; shift
	(
		cd "$dir"
		fileCommit \
			Dockerfile \
			$(git show HEAD:./Dockerfile | awk '
				toupper($1) == "COPY" {
					for (i = 2; i < NF; i++) {
						print $i
					}
				}
			')
	)
}

cat <<-EOH
# this file is generated via https://github.com/docker-library/django/blob/$(fileCommit "$self")/$self

Maintainers: Tianon Gravi <admwiggin@gmail.com> (@tianon),
             Joseph Ferguson <yosifkit@gmail.com> (@yosifkit)
GitRepo: https://github.com/docker-library/django.git
EOH

# prints "$2$1$3$1...$N"
join() {
	local sep="$1"; shift
	local out; printf -v out "${sep//%/%%}%s" "$@"
	echo "${out#$sep}"
}

for pyVersion in "${pyVersions[@]}"; do
	pyMajor="${pyVersion%.*}"

	commit="$(dirCommit "$pyVersion")"

	fullVersion="$(git show "$commit":"$pyVersion/Dockerfile" | awk '$1 == "ENV" && $2 == "DJANGO_VERSION" { print $3; exit }')"

	versionAliases=()
	while [ "${fullVersion%[.-]*}" != "$fullVersion" ]; do
		versionAliases+=( $fullVersion )
		fullVersion="${fullVersion%[.-]*}"
	done
	versionAliases+=(
		$fullVersion
		latest
	)

	variant="python$pyMajor"

	variantAliases=( "${versionAliases[@]/%/-$variant}" )
	variantAliases=( "${variantAliases[@]//latest-/}" )

	if [ "$pyMajor" = "$latestPythonMajor" ]; then
		variantAliases+=( "${versionAliases[@]}" )
	fi

	echo
	cat <<-EOE
		Tags: $(join ', ' "${variantAliases[@]}")
		GitCommit: $commit
		Directory: $pyVersion
	EOE

	for subVariant in onbuild; do
		[ -f "$pyVersion/$subVariant/Dockerfile" ] || continue

		commit="$(dirCommit "$pyVersion/$subVariant")"

		variantAliases=( "$variant-$subVariant" )
		if [ "$pyMajor" = "$latestPythonMajor" ]; then
			variantAliases+=( "$subVariant" )
		fi

		echo
		cat <<-EOE
			Tags: $(join ', ' "${variantAliases[@]}")
			GitCommit: $commit
			Directory: $pyVersion/$subVariant
		EOE
	done
done


================================================
FILE: update.sh
================================================
#!/bin/bash
set -eo pipefail

cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"

versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
	versions=( */ )
fi
versions=( "${versions[@]%/}" )

#current="$(curl -sSL 'https://pypi.python.org/pypi/django/json' | awk -F '"' '$2 == "version" { print $4 }')" # UGH "1.8a1"
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"

travisEnv=
for version in "${versions[@]}"; do
	( set -x; sed -ri 's/^(ENV DJANGO_VERSION) .*/\1 '"$current"'/' "$version/Dockerfile" )
	
	pythonOnbuildDockerfile="https://raw.githubusercontent.com/docker-library/python/master/$version/onbuild/Dockerfile"
	( set -x; curl -sSL "$pythonOnbuildDockerfile" -o "$version/onbuild/Dockerfile" )
	{
		echo
		# see http://stackoverflow.com/a/12776899 (line continuations eat our lunch)
		sed -n ': begin; /\\$/ { N; b begin }; /apt-get/ p' "$version/Dockerfile"
		echo
		echo 'EXPOSE 8000'
		echo 'CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]'
	} >> "$version/onbuild/Dockerfile"
	
	from="$(awk '$1 == "FROM" { print $2 }' "$version/onbuild/Dockerfile")"
	( set -x; sed -ri 's/^(FROM) .*/\1 '"$from"'-slim/' "$version/Dockerfile" )
	
	travisEnv='\n  - PY_VERSION='"$version$travisEnv"
done

travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
echo "$travis" > .travis.yml
Download .txt
gitextract_1xzrnk5n/

├── .travis.yml
├── 2.7/
│   ├── Dockerfile
│   └── onbuild/
│       └── Dockerfile
├── 3.4/
│   ├── Dockerfile
│   └── onbuild/
│       └── Dockerfile
├── LICENSE
├── README.md
├── generate-stackbrew-library.sh
└── update.sh
Condensed preview — 9 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (11K chars).
[
  {
    "path": ".travis.yml",
    "chars": 447,
    "preview": "language: bash\nservices: docker\n\nenv:\n  - PY_VERSION=3.4\n  - PY_VERSION=2.7\n\ninstall:\n  - git clone https://github.com/d"
  },
  {
    "path": "2.7/Dockerfile",
    "chars": 312,
    "preview": "FROM python:2.7-slim\n\nRUN apt-get update && apt-get install -y \\\n\t\tgcc \\\n\t\tgettext \\\n\t\tmysql-client libmysqlclient-dev \\"
  },
  {
    "path": "2.7/onbuild/Dockerfile",
    "chars": 467,
    "preview": "FROM python:2.7\n\nRUN mkdir -p /usr/src/app\nWORKDIR /usr/src/app\n\nONBUILD COPY requirements.txt /usr/src/app/\nONBUILD RUN"
  },
  {
    "path": "3.4/Dockerfile",
    "chars": 312,
    "preview": "FROM python:3.4-slim\n\nRUN apt-get update && apt-get install -y \\\n\t\tgcc \\\n\t\tgettext \\\n\t\tmysql-client libmysqlclient-dev \\"
  },
  {
    "path": "3.4/onbuild/Dockerfile",
    "chars": 561,
    "preview": "#\n# NOTE: THIS DOCKERFILE IS GENERATED VIA \"update.sh\"\n#\n# PLEASE DO NOT EDIT IT DIRECTLY.\n#\n\nFROM python:3.4\n\nRUN mkdir"
  },
  {
    "path": "LICENSE",
    "chars": 1538,
    "preview": "Copyright (c) Docker, Inc. and individual contributors.\nAll rights reserved.\n\nRedistribution and use in source and binar"
  },
  {
    "path": "README.md",
    "chars": 2374,
    "preview": "# DEPRECATED\n\nThis image is officially deprecated in favor of [the standard `python` image](https://hub.docker.com/_/pyt"
  },
  {
    "path": "generate-stackbrew-library.sh",
    "chars": 2361,
    "preview": "#!/bin/bash\nset -eu\n\nlatestPythonMajor='3'\n\nself=\"$(basename \"$BASH_SOURCE\")\"\ncd \"$(dirname \"$(readlink -f \"$BASH_SOURCE"
  },
  {
    "path": "update.sh",
    "chars": 1572,
    "preview": "#!/bin/bash\nset -eo pipefail\n\ncd \"$(dirname \"$(readlink -f \"$BASH_SOURCE\")\")\"\n\nversions=( \"$@\" )\nif [ ${#versions[@]} -e"
  }
]

About this extraction

This page contains the full source code of the docker-library/django GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 9 files (9.7 KB), approximately 3.1k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!