-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathDockerfile
43 lines (32 loc) · 1.43 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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-12-19T19:45:37Z
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.29.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"]