From 07ef8633d2cb7ee4794a72f52ebb13bd995f2f96 Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Thu, 8 Aug 2024 14:15:28 +0800 Subject: [PATCH 1/4] Include psycopg[binary,pool] extras. --- poetry.lock | 80 +++++++++++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 2 +- 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index a52d6ce..4532ab1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -579,6 +579,8 @@ files = [ ] [package.dependencies] +psycopg-binary = {version = "3.2.1", optional = true, markers = "implementation_name != \"pypy\" and extra == \"binary\""} +psycopg-pool = {version = "*", optional = true, markers = "extra == \"pool\""} typing-extensions = ">=4.4" tzdata = {version = "*", markers = "sys_platform == \"win32\""} @@ -590,6 +592,82 @@ docs = ["Sphinx (>=5.0)", "furo (==2022.6.21)", "sphinx-autobuild (>=2021.3.14)" pool = ["psycopg-pool"] test = ["anyio (>=4.0)", "mypy (>=1.6)", "pproxy (>=2.7)", "pytest (>=6.2.5)", "pytest-cov (>=3.0)", "pytest-randomly (>=3.5)"] +[[package]] +name = "psycopg-binary" +version = "3.2.1" +description = "PostgreSQL database adapter for Python -- C optimisation distribution" +optional = false +python-versions = ">=3.8" +files = [ + {file = "psycopg_binary-3.2.1-cp310-cp310-macosx_12_0_x86_64.whl", hash = "sha256:cad2de17804c4cfee8640ae2b279d616bb9e4734ac3c17c13db5e40982bd710d"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:592b27d6c46a40f9eeaaeea7c1fef6f3c60b02c634365eb649b2d880669f149f"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9a997efbaadb5e1a294fb5760e2f5643d7b8e4e3fe6cb6f09e6d605fd28e0291"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c1d2b6438fb83376f43ebb798bf0ad5e57bc56c03c9c29c85bc15405c8c0ac5a"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b1f087bd84bdcac78bf9f024ebdbfacd07fc0a23ec8191448a50679e2ac4a19e"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:415c3b72ea32119163255c6504085f374e47ae7345f14bc3f0ef1f6e0976a879"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:f092114f10f81fb6bae544a0ec027eb720e2d9c74a4fcdaa9dd3899873136935"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:06a7aae34edfe179ddc04da005e083ff6c6b0020000399a2cbf0a7121a8a22ea"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:0b018631e5c80ce9bc210b71ea885932f9cca6db131e4df505653d7e3873a938"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:f8a509aeaac364fa965454e80cd110fe6d48ba2c80f56c9b8563423f0b5c3cfd"}, + {file = "psycopg_binary-3.2.1-cp310-cp310-win_amd64.whl", hash = "sha256:413977d18412ff83486eeb5875eb00b185a9391c57febac45b8993bf9c0ff489"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-macosx_12_0_x86_64.whl", hash = "sha256:62b1b7b07e00ee490afb39c0a47d8282a9c2822c7cfed9553a04b0058adf7e7f"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:f8afb07114ea9b924a4a0305ceb15354ccf0ef3c0e14d54b8dbeb03e50182dd7"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:40bb515d042f6a345714ec0403df68ccf13f73b05e567837d80c886c7c9d3805"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:6418712ba63cebb0c88c050b3997185b0ef54173b36568522d5634ac06153040"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:101472468d59c74bb8565fab603e032803fd533d16be4b2d13da1bab8deb32a3"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa3931f308ab4a479d0ee22dc04bea867a6365cac0172e5ddcba359da043854b"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:dc314a47d44fe1a8069b075a64abffad347a3a1d8652fed1bab5d3baea37acb2"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:cc304a46be1e291031148d9d95c12451ffe783ff0cc72f18e2cc7ec43cdb8c68"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:6f9e13600647087df5928875559f0eb8f496f53e6278b7da9511b4b3d0aff960"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b140182830c76c74d17eba27df3755a46442ce8d4fb299e7f1cf2f74a87c877b"}, + {file = "psycopg_binary-3.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:3c838806eeb99af39f934b7999e35f947a8e577997cc892c12b5053a97a9057f"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-macosx_12_0_x86_64.whl", hash = "sha256:7066d3dca196ed0dc6172f9777b2d62e4f138705886be656cccff2d555234d60"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:28ada5f610468c57d8a4a055a8ea915d0085a43d794266c4f3b9d02f4288f4db"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2e8213bf50af073b1aa8dc3cff123bfeedac86332a16c1b7274910bc88a847c7"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:74d623261655a169bc84a9669890975c229f2fa6e19a7f2d10a77675dcf1a707"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:42781ba94e8842ee98bca5a7d0c44cc9d067500fedca2d6a90fa3609b6d16b42"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:33e6669091d09f8ba36e10ce678a6d9916e110446236a9b92346464a3565635e"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:b09e8a576a2ac69d695032ee76f31e03b30781828b5dd6d18c6a009e5a3d1c35"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:8f28ff0cb9f1defdc4a6f8c958bf6787274247e7dfeca811f6e2f56602695fb1"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:4c84fcac8a3a3479ac14673095cc4e1fdba2935499f72c436785ac679bec0d1a"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:950fd666ec9e9fe6a8eeb2b5a8f17301790e518953730ad44d715b59ffdbc67f"}, + {file = "psycopg_binary-3.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:334046a937bb086c36e2c6889fe327f9f29bfc085d678f70fac0b0618949f674"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-macosx_12_0_x86_64.whl", hash = "sha256:1d6833f607f3fc7b22226a9e121235d3b84c0eda1d3caab174673ef698f63788"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d353e028b8f848b9784450fc2abf149d53a738d451eab3ee4c85703438128b9"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f34e369891f77d0738e5d25727c307d06d5344948771e5379ea29c76c6d84555"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0ab58213cc976a1666f66bc1cb2e602315cd753b7981a8e17237ac2a185bd4a1"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b0104a72a17aa84b3b7dcab6c84826c595355bf54bb6ea6d284dcb06d99c6801"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:059cbd4e6da2337e17707178fe49464ed01de867dc86c677b30751755ec1dc51"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-musllinux_1_2_i686.whl", hash = "sha256:73f9c9b984be9c322b5ec1515b12df1ee5896029f5e72d46160eb6517438659c"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:af0469c00f24c4bec18c3d2ede124bf62688d88d1b8a5f3c3edc2f61046fe0d7"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:463d55345f73ff391df8177a185ad57b552915ad33f5cc2b31b930500c068b22"}, + {file = "psycopg_binary-3.2.1-cp38-cp38-win_amd64.whl", hash = "sha256:302b86f92c0d76e99fe1b5c22c492ae519ce8b98b88d37ef74fda4c9e24c6b46"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-macosx_12_0_x86_64.whl", hash = "sha256:0879b5d76b7d48678d31278242aaf951bc2d69ca4e4d7cef117e4bbf7bfefda9"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f99e59f8a5f4dcd9cbdec445f3d8ac950a492fc0e211032384d6992ed3c17eb7"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:84837e99353d16c6980603b362d0f03302d4b06c71672a6651f38df8a482923d"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7ce965caf618061817f66c0906f0452aef966c293ae0933d4fa5a16ea6eaf5bb"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:78c2007caf3c90f08685c5378e3ceb142bafd5636be7495f7d86ec8a977eaeef"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:7a84b5eb194a258116154b2a4ff2962ea60ea52de089508db23a51d3d6b1c7d1"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:4a42b8f9ab39affcd5249b45cac763ac3cf12df962b67e23fd15a2ee2932afe5"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:788ffc43d7517c13e624c83e0e553b7b8823c9655e18296566d36a829bfb373f"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:21927f41c4d722ae8eb30d62a6ce732c398eac230509af5ba1749a337f8a63e2"}, + {file = "psycopg_binary-3.2.1-cp39-cp39-win_amd64.whl", hash = "sha256:921f0c7f39590763d64a619de84d1b142587acc70fd11cbb5ba8fa39786f3073"}, +] + +[[package]] +name = "psycopg-pool" +version = "3.2.2" +description = "Connection Pool for Psycopg" +optional = false +python-versions = ">=3.8" +files = [ + {file = "psycopg_pool-3.2.2-py3-none-any.whl", hash = "sha256:273081d0fbfaced4f35e69200c89cb8fbddfe277c38cc86c235b90a2ec2c8153"}, + {file = "psycopg_pool-3.2.2.tar.gz", hash = "sha256:9e22c370045f6d7f2666a5ad1b0caf345f9f1912195b0b25d0d3bcc4f3a7389c"}, +] + +[package.dependencies] +typing-extensions = ">=4.4" + [[package]] name = "ptyprocess" version = "0.7.0" @@ -911,4 +989,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.11" -content-hash = "575220f31516b05efa217fe35843b206147b3fcc4033948825101c4c32e5b7dc" +content-hash = "79186b5e6a8c1eee67cfa21faa4f197912e84b192aa09869352690a5f6faf162" diff --git a/pyproject.toml b/pyproject.toml index f148d64..0b57a78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ package-mode = false [tool.poetry.dependencies] python = ">=3.11" django = "4.2.15" -psycopg = "3.2.1" +psycopg = {version = "3.2.1", extras = ["binary", "pool"]} dbca-utils = "2.0.2" django-extensions = "3.2.3" python-dotenv = "1.0.1" From cb6b674723bb0d60303b13825955e57e07b36c02 Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Wed, 11 Sep 2024 10:24:52 +0800 Subject: [PATCH 2/4] Update project to use Python 3.12, increment minor version. --- Dockerfile | 8 ++-- kustomize/overlays/prod/kustomization.yaml | 2 +- poetry.lock | 55 +++++++++++----------- pyproject.toml | 8 ++-- 4 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5796e5..f935b0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 # Prepare the base environment. -FROM python:3.11.9-slim AS builder_base_ibms +FROM python:3.12.4-slim AS builder_base_ibms LABEL org.opencontainers.image.authors=asi@dbca.wa.gov.au LABEL org.opencontainers.image.source=https://github.com/dbca-wa/ibms @@ -14,7 +14,7 @@ RUN apt-get update -y \ FROM builder_base_ibms AS python_libs_ibms WORKDIR /app ARG POETRY_VERSION=1.8.3 -RUN pip install --root-user-action=ignore poetry=="${POETRY_VERSION}" +RUN pip install --no-cache-dir --root-user-action=ignore poetry==${POETRY_VERSION} COPY poetry.lock pyproject.toml ./ RUN poetry config virtualenvs.create false \ && poetry install --no-interaction --no-ansi --only main @@ -22,8 +22,8 @@ RUN poetry config virtualenvs.create false \ # Create a non-root user. ARG UID=10001 ARG GID=10001 -RUN groupadd -g "${GID}" appuser \ - && useradd --no-create-home --no-log-init --uid "${UID}" --gid "${GID}" appuser +RUN groupadd -g ${GID} appuser \ + && useradd --no-create-home --no-log-init --uid ${UID} --gid ${GID} appuser # Install the project. FROM python_libs_ibms diff --git a/kustomize/overlays/prod/kustomization.yaml b/kustomize/overlays/prod/kustomization.yaml index 6cd42e2..c14aabe 100644 --- a/kustomize/overlays/prod/kustomization.yaml +++ b/kustomize/overlays/prod/kustomization.yaml @@ -20,4 +20,4 @@ patches: - path: service_patch.yaml images: - name: ghcr.io/dbca-wa/ibms - newTag: 2.8.9 + newTag: 2.8.10 diff --git a/poetry.lock b/poetry.lock index 4532ab1..96eb3c8 100644 --- a/poetry.lock +++ b/poetry.lock @@ -275,13 +275,13 @@ files = [ [[package]] name = "executing" -version = "2.0.1" +version = "2.1.0" description = "Get the currently executing AST node of a frame, and other information" optional = false -python-versions = ">=3.5" +python-versions = ">=3.8" files = [ - {file = "executing-2.0.1-py2.py3-none-any.whl", hash = "sha256:eac49ca94516ccc753f9fb5ce82603156e590b27525a8bc32cce8ae302eb61bc"}, - {file = "executing-2.0.1.tar.gz", hash = "sha256:35afe2ce3affba8ee97f2d69927fa823b08b472b7b994e36a52a964b93d16147"}, + {file = "executing-2.1.0-py2.py3-none-any.whl", hash = "sha256:8d63781349375b5ebccc3142f4b30350c0cd9c79f921cde38be2be4637e98eaf"}, + {file = "executing-2.1.0.tar.gz", hash = "sha256:8ea27ddd260da8150fa5a708269c4a10e76161e2496ec3e587da9e3c0fe4b9ab"}, ] [package.extras] @@ -303,29 +303,29 @@ python-dateutil = ">=2.4" [[package]] name = "filelock" -version = "3.15.4" +version = "3.16.0" description = "A platform independent file lock." optional = false python-versions = ">=3.8" files = [ - {file = "filelock-3.15.4-py3-none-any.whl", hash = "sha256:6ca1fffae96225dab4c6eaf1c4f4f28cd2568d3ec2a44e15a08520504de468e7"}, - {file = "filelock-3.15.4.tar.gz", hash = "sha256:2207938cbc1844345cb01a5a95524dae30f0ce089eba5b00378295a17e3e90cb"}, + {file = "filelock-3.16.0-py3-none-any.whl", hash = "sha256:f6ed4c963184f4c84dd5557ce8fece759a3724b37b80c6c4f20a2f63a4dc6609"}, + {file = "filelock-3.16.0.tar.gz", hash = "sha256:81de9eb8453c769b63369f87f11131a7ab04e367f8d97ad39dc230daa07e3bec"}, ] [package.extras] -docs = ["furo (>=2023.9.10)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] -testing = ["covdefaults (>=2.3)", "coverage (>=7.3.2)", "diff-cover (>=8.0.1)", "pytest (>=7.4.3)", "pytest-asyncio (>=0.21)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)", "pytest-timeout (>=2.2)", "virtualenv (>=20.26.2)"] -typing = ["typing-extensions (>=4.8)"] +docs = ["furo (>=2024.8.6)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"] +testing = ["covdefaults (>=2.3)", "coverage (>=7.6.1)", "diff-cover (>=9.1.1)", "pytest (>=8.3.2)", "pytest-asyncio (>=0.24)", "pytest-cov (>=5)", "pytest-mock (>=3.14)", "pytest-timeout (>=2.3.1)", "virtualenv (>=20.26.3)"] +typing = ["typing-extensions (>=4.12.2)"] [[package]] name = "gunicorn" -version = "22.0.0" +version = "23.0.0" description = "WSGI HTTP Server for UNIX" optional = false python-versions = ">=3.7" files = [ - {file = "gunicorn-22.0.0-py3-none-any.whl", hash = "sha256:350679f91b24062c86e386e198a15438d53a7a8207235a78ba1b53df4c4378d9"}, - {file = "gunicorn-22.0.0.tar.gz", hash = "sha256:4a0b436239ff76fb33f11c07a16482c521a7e09c1ce3cc293c2330afe01bec63"}, + {file = "gunicorn-23.0.0-py3-none-any.whl", hash = "sha256:ec400d38950de4dfd418cff8328b2c8faed0edb0d517d3394e457c317908ca4d"}, + {file = "gunicorn-23.0.0.tar.gz", hash = "sha256:f014447a0101dc57e294f6c18ca6b40227a4c90e9bdb586042628030cba004ec"}, ] [package.dependencies] @@ -369,13 +369,13 @@ ipython = {version = ">=7.31.1", markers = "python_version >= \"3.11\""} [[package]] name = "ipython" -version = "8.26.0" +version = "8.27.0" description = "IPython: Productive Interactive Computing" optional = false python-versions = ">=3.10" files = [ - {file = "ipython-8.26.0-py3-none-any.whl", hash = "sha256:e6b347c27bdf9c32ee9d31ae85defc525755a1869f14057e900675b9e8d6e6ff"}, - {file = "ipython-8.26.0.tar.gz", hash = "sha256:1cec0fbba8404af13facebe83d04436a7434c7400e59f47acf467c64abd0956c"}, + {file = "ipython-8.27.0-py3-none-any.whl", hash = "sha256:f68b3cb8bde357a5d7adc9598d57e22a45dfbea19eb6b98286fa3b288c9cd55c"}, + {file = "ipython-8.27.0.tar.gz", hash = "sha256:0b99a2dc9f15fd68692e898e5568725c6d49c527d36a9fb5960ffbdeaa82ff7e"}, ] [package.dependencies] @@ -388,7 +388,6 @@ prompt-toolkit = ">=3.0.41,<3.1.0" pygments = ">=2.4.0" stack-data = "*" traitlets = ">=5.13.0" -typing-extensions = {version = ">=4.6", markers = "python_version < \"3.12\""} [package.extras] all = ["ipython[black,doc,kernel,matplotlib,nbconvert,nbformat,notebook,parallel,qtconsole]", "ipython[test,test-extra]"] @@ -521,19 +520,19 @@ ptyprocess = ">=0.5" [[package]] name = "platformdirs" -version = "4.2.2" +version = "4.3.2" description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." optional = false python-versions = ">=3.8" files = [ - {file = "platformdirs-4.2.2-py3-none-any.whl", hash = "sha256:2d7a1657e36a80ea911db832a8a6ece5ee53d8de21edd5cc5879af6530b1bfee"}, - {file = "platformdirs-4.2.2.tar.gz", hash = "sha256:38b7b51f512eed9e84a22788b4bce1de17c0adb134d6becb09836e37d8654cd3"}, + {file = "platformdirs-4.3.2-py3-none-any.whl", hash = "sha256:eb1c8582560b34ed4ba105009a4badf7f6f85768b30126f351328507b2beb617"}, + {file = "platformdirs-4.3.2.tar.gz", hash = "sha256:9e5e27a08aa095dd127b9f2e764d74254f482fef22b0970773bfba79d091ab8c"}, ] [package.extras] -docs = ["furo (>=2023.9.10)", "proselint (>=0.13)", "sphinx (>=7.2.6)", "sphinx-autodoc-typehints (>=1.25.2)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.4.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.12)"] -type = ["mypy (>=1.8)"] +docs = ["furo (>=2024.8.6)", "proselint (>=0.14)", "sphinx (>=8.0.2)", "sphinx-autodoc-typehints (>=2.4)"] +test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=8.3.2)", "pytest-cov (>=5)", "pytest-mock (>=3.14)"] +type = ["mypy (>=1.11.2)"] [[package]] name = "pre-commit" @@ -881,13 +880,13 @@ files = [ [[package]] name = "virtualenv" -version = "20.26.3" +version = "20.26.4" description = "Virtual Python Environment builder" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.26.3-py3-none-any.whl", hash = "sha256:8cc4a31139e796e9a7de2cd5cf2489de1217193116a8fd42328f1bd65f434589"}, - {file = "virtualenv-20.26.3.tar.gz", hash = "sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a"}, + {file = "virtualenv-20.26.4-py3-none-any.whl", hash = "sha256:48f2695d9809277003f30776d155615ffc11328e6a0a8c1f0ec80188d7874a55"}, + {file = "virtualenv-20.26.4.tar.gz", hash = "sha256:c17f4e0f3e6036e9f26700446f85c76ab11df65ff6d8a9cbfad9f71aabfcf23c"}, ] [package.dependencies] @@ -988,5 +987,5 @@ files = [ [metadata] lock-version = "2.0" -python-versions = ">=3.11" -content-hash = "79186b5e6a8c1eee67cfa21faa4f197912e84b192aa09869352690a5f6faf162" +python-versions = "~3.12" +content-hash = "435892a753aad0b63f00d20614a3572489dd5c4a9303d9ce085ae327a73ffe87" diff --git a/pyproject.toml b/pyproject.toml index 0b57a78..f3bdc18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,20 @@ [tool.poetry] name = "ibms" -version = "2.8.9" +version = "2.8.10" description = "Integrated Business Management System corporate application" authors = ["Ashley Felton "] license = "Apache-2.0" package-mode = false [tool.poetry.dependencies] -python = ">=3.11" +python = "~3.12" django = "4.2.15" psycopg = {version = "3.2.1", extras = ["binary", "pool"]} dbca-utils = "2.0.2" django-extensions = "3.2.3" python-dotenv = "1.0.1" dj-database-url = "2.2.0" -gunicorn = "22.0.0" +gunicorn = "23.0.0" django-crispy-forms = "2.3" crispy-bootstrap5 = "2024.2" xlrd = "2.0.1" # TODO: deprecate @@ -26,7 +26,7 @@ whitenoise = {version = "6.7.0", extras = ["brotli"]} mixer = "7.2.2" [tool.poetry.group.dev.dependencies] -ipython = "^8.26.0" +ipython = "^8.27.0" ipdb = "^0.13.13" pre-commit = "^3.8.0" From 8fda286d01cac005e3b4e7b5cbb249f2e2bb5a48 Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Wed, 11 Sep 2024 10:27:14 +0800 Subject: [PATCH 3/4] Update GitHub workflow. --- .github/dependabot.yml | 4 ++-- .github/workflows/run-tests.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5a9fb03..4944c77 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,9 +4,9 @@ updates: directory: "/" schedule: interval: "weekly" + target-branch: "master" - package-ecosystem: "github-actions" - # Workflow files stored in the - # default location of `.github/workflows` directory: "/" schedule: interval: "weekly" + target-branch: "master" diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index cbc362a..973b346 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -33,7 +33,7 @@ jobs: uses: actions/setup-python@v5 id: setup-python with: - python-version: '3.11' + python-version: '3.12' #---------------------------------------------- # Install & configure Poetry #---------------------------------------------- From 7a2d7daf61b6d8dea813f79fea836569ac585f76 Mon Sep 17 00:00:00 2001 From: Ashley Felton Date: Wed, 11 Sep 2024 11:03:02 +0800 Subject: [PATCH 4/4] Alpine-based Dockerfile. --- Dockerfile | 39 ++++++++++++++++++++++----------------- Dockerfile.debian | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 17 deletions(-) create mode 100644 Dockerfile.debian diff --git a/Dockerfile b/Dockerfile index f935b0f..a8ce41f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,41 @@ # syntax=docker/dockerfile:1 # Prepare the base environment. -FROM python:3.12.4-slim AS builder_base_ibms +FROM python:3.12.6-alpine AS builder_base_ibms LABEL org.opencontainers.image.authors=asi@dbca.wa.gov.au LABEL org.opencontainers.image.source=https://github.com/dbca-wa/ibms -RUN apt-get update -y \ - && apt-get upgrade -y \ - && apt-get install -y python3-dev libpq-dev gcc \ - && rm -rf /var/lib/apt/lists/* \ - && pip install --root-user-action=ignore --upgrade pip +# Install system requirements to build Python packages. +RUN apk add --no-cache \ + gcc \ + libressl-dev \ + musl-dev \ + libffi-dev +# Create a non-root user to run the application. +ARG UID=10001 +ARG GID=10001 +RUN addgroup -g ${GID} appuser \ + && adduser -H -D -u ${UID} -G appuser appuser # Install Python libs using Poetry. FROM builder_base_ibms AS python_libs_ibms WORKDIR /app -ARG POETRY_VERSION=1.8.3 -RUN pip install --no-cache-dir --root-user-action=ignore poetry==${POETRY_VERSION} COPY poetry.lock pyproject.toml ./ -RUN poetry config virtualenvs.create false \ +ARG POETRY_VERSION=1.8.3 +RUN pip install --no-cache-dir --root-user-action=ignore poetry==${POETRY_VERSION} \ + && poetry config virtualenvs.create false \ && poetry install --no-interaction --no-ansi --only main - -# Create a non-root user. -ARG UID=10001 -ARG GID=10001 -RUN groupadd -g ${GID} appuser \ - && useradd --no-create-home --no-log-init --uid ${UID} --gid ${GID} appuser +# Remove system libraries, no longer required. +RUN apk del \ + gcc \ + libressl-dev \ + musl-dev \ + libffi-dev # Install the project. -FROM python_libs_ibms +FROM python_libs_ibms AS project_ibms COPY manage.py gunicorn.py ./ COPY ibms_project ./ibms_project RUN python manage.py collectstatic --noinput - USER ${UID} EXPOSE 8080 CMD ["gunicorn", "ibms_project.wsgi", "--config", "gunicorn.py"] diff --git a/Dockerfile.debian b/Dockerfile.debian new file mode 100644 index 0000000..f935b0f --- /dev/null +++ b/Dockerfile.debian @@ -0,0 +1,36 @@ +# syntax=docker/dockerfile:1 +# Prepare the base environment. +FROM python:3.12.4-slim AS builder_base_ibms +LABEL org.opencontainers.image.authors=asi@dbca.wa.gov.au +LABEL org.opencontainers.image.source=https://github.com/dbca-wa/ibms + +RUN apt-get update -y \ + && apt-get upgrade -y \ + && apt-get install -y python3-dev libpq-dev gcc \ + && rm -rf /var/lib/apt/lists/* \ + && pip install --root-user-action=ignore --upgrade pip + +# Install Python libs using Poetry. +FROM builder_base_ibms AS python_libs_ibms +WORKDIR /app +ARG POETRY_VERSION=1.8.3 +RUN pip install --no-cache-dir --root-user-action=ignore poetry==${POETRY_VERSION} +COPY poetry.lock pyproject.toml ./ +RUN poetry config virtualenvs.create false \ + && poetry install --no-interaction --no-ansi --only main + +# Create a non-root user. +ARG UID=10001 +ARG GID=10001 +RUN groupadd -g ${GID} appuser \ + && useradd --no-create-home --no-log-init --uid ${UID} --gid ${GID} appuser + +# Install the project. +FROM python_libs_ibms +COPY manage.py gunicorn.py ./ +COPY ibms_project ./ibms_project +RUN python manage.py collectstatic --noinput + +USER ${UID} +EXPOSE 8080 +CMD ["gunicorn", "ibms_project.wsgi", "--config", "gunicorn.py"]