forked from django/django-docker-box
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removed outdated configuration for Azure Pipelines - Removed outdated configuration for Travis CI - Removed obsolete `PIP_CACHE_VOLUME` from `.env` - Removed obsolete entries from `.gitignore` - Removed obsolete support for unofficial Oracle images - Removed obsolete `docker_push.sh` script - Added workflow for linting in GitHub Actions - Added `pre-commit`, `hadolint`, `ruff`, and `yamllint` for linting - Default `DJANGO_PATH` to `../django`, i.e. assume adjacent checkouts - Updated `Dockerfile` to use modern syntax, including: - Using here documents with `RUN` to avoid backslash escaping - Using `--mount=type=cache,...` with `RUN` to improve build speed - Updated `apt-get` and `pip` installation to be more optimal: - Enabled caching of downloads for both commands - Extracted packages to external files - Combined requirements files to optimise dependency resolution - Included `set -o errexit -o nounset -o pipefail -o xtrace` for `RUN` - Added forced color output, etc. to `Dockerfile` for use in CI - Tided up the location of injected and generated files in the image - Added preliminary support for alternative PyPy - Updated `docker-compose.yml` to use modern features: - Dropped the non-required `version` property - Used `additional_contexts` to source files from multiple places - Used `deploy: mode: global` for databases, etc. - Reverted to using `healthcheck` in place of `wait-for-it.sh` - Added configuration to speed up database services - Added support for Oracle Database Free 23c - Added GIS support for MariaDB and Oracle - Added Edge support for testing with Selenium - Renamed `Dockerfile` to `Containerfile` - Renamed `docker-compose.yml` to `compose.yaml` - Added support for running coverage via a custom entry point - Added support for extracting reports generated by lint/test tooling - Merged settings files into a single dynamic file - Updated README to document all of the changes and features - Added a LICENSE file using the same license as Django
- Loading branch information
Showing
34 changed files
with
722 additions
and
774 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,3 +1,3 @@ | ||
.git/ | ||
.dockerignore/ | ||
django | ||
django |
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,6 +1,7 @@ | ||
PYTHON_VERSION=3.8 | ||
POSTGRES_VERSION=12 | ||
POSTGIS_VERSION=2.5 | ||
PYTHON_IMPLEMENTATION=python | ||
PYTHON_VERSION=3.10 | ||
MARIADB_VERSION=11.2 | ||
MYSQL_VERSION=8 | ||
MARIADB_VERSION=10.4 | ||
PIP_CACHE_VOLUME=pip-cache | ||
ORACLE_VERSION=23.3.0.0 | ||
POSTGIS_VERSION=3.4 | ||
POSTGRES_VERSION=16 |
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,38 @@ | ||
--- | ||
name: Lint | ||
|
||
on: # yamllint disable-line rule:truthy | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
COLUMNS: '120' | ||
FORCE_COLOR: '1' | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
name: pre-commit | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
cache: pip | ||
- name: Install packages | ||
run: python -m pip install --upgrade pip pre-commit | ||
- name: Run linting tools | ||
run: pre-commit run --all-files | ||
env: | ||
PRE_COMMIT_COLOR: always |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
--- | ||
ignored: | ||
- DL3013 # Don't complain when upgrading to latest version of pip | ||
- DL3022 # Due to use of additional_contexts in compose.yaml | ||
- DL3042 # Caching is desired with RUN --mount=type=cache |
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,49 @@ | ||
--- | ||
ci: | ||
autoupdate_schedule: weekly | ||
repos: | ||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
- id: check-useless-excludes | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-builtin-literals | ||
- id: check-case-conflict | ||
- id: check-docstring-first | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
# - id: check-toml | ||
- id: check-vcs-permalinks | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: file-contents-sorter | ||
args: [--unique] | ||
files: ^(?:packages|requirements)\.txt$ | ||
- id: fix-byte-order-marker | ||
- id: fix-encoding-pragma | ||
args: [--remove] | ||
- id: requirements-txt-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.7 | ||
hooks: | ||
- id: ruff | ||
args: [--exit-non-zero-on-fix, --fix] | ||
- id: ruff-format | ||
args: [--check] | ||
- repo: https://github.com/adrienverge/yamllint.git | ||
rev: v1.33.0 | ||
hooks: | ||
- id: yamllint | ||
args: [--strict] | ||
- repo: https://github.com/hadolint/hadolint | ||
rev: v2.12.0 | ||
hooks: | ||
- id: hadolint-docker | ||
name: hadolint |
This file was deleted.
Oops, something went wrong.
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,66 @@ | ||
# syntax=docker/dockerfile:1.6 | ||
|
||
ARG PYTHON_IMPLEMENTATION | ||
ARG PYTHON_VERSION | ||
FROM ${PYTHON_IMPLEMENTATION}:${PYTHON_VERSION}-slim-bookworm | ||
|
||
LABEL org.opencontainers.image.authors="Django Software Foundation" | ||
LABEL org.opencontainers.image.url="https://github.com/django/django-docker-box" | ||
LABEL org.opencontainers.image.documentation="https://github.com/django/django-docker-box" | ||
LABEL org.opencontainers.image.source="https://github.com/django/django-docker-box" | ||
LABEL org.opencontainers.image.vendor="Django Software Foundation" | ||
LABEL org.opencontainers.image.licenses="BSD-3-Clause" | ||
LABEL org.opencontainers.image.title="Django Docker Box" | ||
LABEL org.opencontainers.image.description="Container image for developing and testing Django." | ||
|
||
SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-o", "xtrace", "-c"] | ||
|
||
# Force colored output for various tooling in CI. | ||
ENV COLUMNS=120 | ||
ENV FORCE_COLOR=1 | ||
ENV TERM="xterm-256color" | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV PYTHONUNBUFFERED=1 | ||
|
||
# Create user and prepare directories. | ||
RUN <<EOF | ||
useradd --no-create-home --no-log-init django | ||
mkdir --parents /django/{output,source} | ||
chown --recursive django:django /django | ||
EOF | ||
|
||
# Install system dependencies from package manager. | ||
COPY --chown=django:django packages.txt /django/ | ||
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked <<EOF | ||
rm --force /etc/apt/apt.conf.d/docker-clean | ||
echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache | ||
apt-get update --quiet --yes | ||
xargs --arg-file=/django/packages.txt apt-get install --no-install-recommends --yes | ||
EOF | ||
|
||
# Install all Python requirements in a single command. | ||
COPY --chown=django:django requirements.txt /django/requirements/extra.txt | ||
COPY --chown=django:django --from=src tests/requirements/ /django/requirements/ | ||
COPY --chown=django:django --from=src docs/requirements.txt /django/requirements/docs.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip <<EOF | ||
cat /django/requirements/*.txt \ | ||
| grep --invert-match '^#' \ | ||
| sort --unique --version-sort \ | ||
| tee /django/requirements.txt | ||
python -m pip install --upgrade pip | ||
python -m pip install --requirement=/django/requirements.txt | ||
EOF | ||
|
||
COPY --chown=django:django entrypoint.bash /django/ | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
ENV DJANGO_SETTINGS_MODULE=settings | ||
ENV PYTHONPATH="${PYTHONPATH}:/django/source/" | ||
USER django:django | ||
VOLUME /django/output | ||
VOLUME /django/source | ||
WORKDIR /django/source/tests | ||
ENTRYPOINT ["/django/entrypoint.bash"] |
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
Copyright (c) Django Software Foundation 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. |
Oops, something went wrong.