Skip to content

Commit

Permalink
Add Docker support and configure Dependabot for Docker updates
Browse files Browse the repository at this point in the history
Introduce a Dockerfile for containerized environments and add a .dockerignore file to exclude unnecessary files. Also, update dependabot.yml to include daily checks for Docker image updates.
  • Loading branch information
coordt committed Oct 12, 2024
1 parent cce9e1d commit 0315db4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
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
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 0315db4

Please sign in to comment.