diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..9418769a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +.* +bump_my_version.egg-info/ +docs/ +overrides/ +test-reports/ +tests/ +tools/ +*.yaml +CODEOWNERS +Dockerfile +Makefile +MANIFEST.in diff --git a/.github/dependabot.yml b/.github/dependabot.yml index be006de9..53f0d143 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d1ad29d3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +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 +ADD . /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 + +# 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"]