-
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.
Use astral uv to build and manage dependencies (#87)
* chore: switch to uv for building * Update Dockerfile * Update image-build.yml * Update image-build.yml Update image-build.yml Revert "Revert "Bump setuptools from 72.0.0 to 75.3.0 (#83)" (#85)" (#86) This reverts commit 7ca0e6a.
- Loading branch information
1 parent
49d35a4
commit 04883c4
Showing
6 changed files
with
548 additions
and
57 deletions.
There are no files selected for viewing
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
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,12 +1,45 @@ | ||
FROM python:3.10-alpine | ||
|
||
LABEL org.opencontainers.image.source = "https://github.com/ministryofjustice/hmpps-ldap-automation-cli" | ||
FROM ghcr.io/astral-sh/uv:python3.12-bookworm AS builder | ||
ENV UV_COMPILE_BYTECODE=1 \ | ||
UV_LINK_MODE=copy \ | ||
UV_PYTHON_DOWNLOADS=never | ||
|
||
ARG VERSION_REF=main | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
bash \ | ||
ca-certificates \ | ||
git \ | ||
build-essential \ | ||
libffi-dev \ | ||
libldap2-dev \ | ||
ldap-utils \ | ||
python3-dev \ | ||
libssl-dev \ | ||
libsasl2-dev | ||
|
||
# Basic tools for now | ||
RUN apk add --update --no-cache bash ca-certificates git build-base libffi-dev openssl-dev gcc musl-dev gcc g++ linux-headers build-base openldap-dev python3-dev | ||
WORKDIR /code | ||
|
||
RUN python3 -m pip install --upgrade pip && python3 -m pip install git+https://github.com/ministryofjustice/hmpps-ldap-automation-cli.git@${VERSION_REF} | ||
# Install dependencies | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
--mount=type=bind,source=uv.lock,target=uv.lock \ | ||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ | ||
uv sync --frozen --no-install-project --no-dev | ||
|
||
# install cli | ||
|
||
COPY . . | ||
RUN --mount=type=cache,target=/root/.cache/uv \ | ||
uv sync --frozen --no-dev | ||
|
||
FROM python:3.12-slim-bookworm | ||
# RUN apk add --update --no-cache bash ca-certificates git build-base libffi-dev openssl-dev gcc musl-dev gcc g++ linux-headers build-base openldap-dev python3-dev | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
bash \ | ||
ca-certificates \ | ||
git \ | ||
ldap-utils | ||
|
||
COPY --from=builder /code /code | ||
ENV PATH="/code/.venv/bin:$PATH" | ||
CMD ["ldap-automation"] | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/ministryofjustice/hmpps-ldap-automation-cli |
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,16 +1,27 @@ | ||
[tool.black] | ||
# PEP-8 line length is not very practical | ||
line-length = 88 | ||
include = '\.pyi?$' | ||
exclude = ''' | ||
/( | ||
\.git | ||
| \.py_cache | ||
| \venv | ||
)/ | ||
''' | ||
[project] | ||
name = "hmpps-ldap-automation-cli" | ||
version = "1.0.1" | ||
description = "An Automation CLI for HMPPS Delius LDAP" | ||
readme = "README.md" | ||
requires-python = ">=3.12" | ||
dependencies = [ | ||
"click>=8.1.7", | ||
"gitpython>=3.1.43", | ||
"jinja2>=3.1.4", | ||
"ldap3>=2.9.1", | ||
"oracledb>=2.5.0", | ||
"pygithub>=2.5.0", | ||
"pyjwt>=2.9.0", | ||
"python-dotenv>=1.0.1", | ||
"python-ldap>=3.4.4", | ||
"requests>=2.32.3", | ||
"setuptools>=75.4.0", | ||
] | ||
|
||
[tool.codespell] | ||
skip = './venv,./rbac,./rendered' | ||
count = '' | ||
quiet-level = 3 | ||
[build-system] | ||
requires = ["setuptools"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
|
||
[project.scripts] | ||
ldap-automation = "cli:main_group" |
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,11 +1,11 @@ | ||
click==8.1.7 | ||
ldap3==2.9.1 | ||
oracledb==1.4 | ||
oracledb==2.4.1 | ||
PyGithub | ||
GitPython==3.1.43 | ||
pyjwt==2.9.0 | ||
python-dotenv==1.0.1 | ||
Jinja2==3.1.4 | ||
python-ldap | ||
requests==2.32.3 | ||
setuptools==72.0.0 | ||
setuptools==75.3.0 |
Oops, something went wrong.