Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed dependency manager to uv and added Docker image #244

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.*
bump_my_version.egg-info/
docs/
overrides/
test-reports/
tests/
tools/
*.yaml
CODEOWNERS
Dockerfile
Makefile
MANIFEST.in
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ updates:
- "*" # Group all Actions updates into a single larger pull request
schedule:
interval: weekly

- package-ecosystem: docker
directory: /
schedule:
interval: "daily" # Update Docker tags daily
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder

ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy

WORKDIR /app

COPY pyproject.toml /app/pyproject.toml
COPY uv.lock /app/uv.lock

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
COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev

FROM python:3.12-slim-bookworm

ARG USERNAME=app
ARG USER_UID=1000
ARG USER_GID=$USER_UID

LABEL org.opencontainers.image.authors="Calloway Project https://github.com/callowayproject"
LABEL org.opencontainers.image.created=2024-10-12T09:38:00Z
LABEL org.opencontainers.image.url=https://github.com/callowayproject/bump-my-version
LABEL org.opencontainers.image.documentation=https://callowayproject.github.io/bump-my-version
LABEL org.opencontainers.image.source=https://github.com/callowayproject/bump-my-version
LABEL org.opencontainers.image.version=0.27.0
LABEL org.opencontainers.image.licenses=MIT

# Add a non-root user and group
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME

COPY --from=builder --chown=$USER_UID:$USER_GID /app /app
USER $USERNAME
WORKDIR /project

# Place executables in the environment at the front of the path
ENV PATH="/app/.venv/bin:$PATH"

ENTRYPOINT ["bump-my-version"]
2 changes: 1 addition & 1 deletion bumpversion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Top-level package for bump-my-version."""

__version__: str = "0.27.0"
__version__ = "0.27.0"
22 changes: 16 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "bump-my-version"
Expand Down Expand Up @@ -85,11 +85,12 @@ test = [
"pytest-sugar",
]

[tool.setuptools.dynamic]
version = {attr = "bumpversion.__version__"}
[tool.hatch.version]
path = "bumpversion/__init__.py"

[tool.hatch.build.targets.wheel]
packages = ["bumpversion"]

[tool.setuptools.packages.find]
exclude = ["example*", "tests*", "docs*", "build", "tools", "site"]

[tool.coverage.run]
branch = true
Expand Down Expand Up @@ -288,6 +289,15 @@ filename = "action.yml"
search = "bump-my-version=={current_version}"
replace = "bump-my-version=={new_version}"

[[tool.bumpversion.files]]
filename = "Dockerfile"
search = "created=\\d{{4}}-\\d{{2}}-\\d{{2}}T\\d{{2}}:\\d{{2}}:\\d{{2}}Z"
replace = "created={utcnow:%Y-%m-%dT%H:%M:%SZ}"
regex = true

[[tool.bumpversion.files]]
filename = "Dockerfile"

[tool.pydoclint]
style = "google"
exclude = '\.git|tests'
Expand Down
Loading
Loading