Skip to content

Commit dd4b9b6

Browse files
committed
refactor: change base image to sysdig-ubi
1 parent 9fa924c commit dd4b9b6

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

Dockerfile

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS builder
22
ENV UV_COMPILE_BYTECODE=1 UV_LINK_MODE=copy
33

4-
# Disable Python downloads, because we want to use the system interpreter
5-
# across both images. If using a managed Python version, it needs to be
6-
# copied from the build image into the final image; see `standalone.Dockerfile`
7-
# for an example.
8-
94
WORKDIR /app
105
COPY . /app
116
RUN apt update && apt install -y git
@@ -16,22 +11,28 @@ RUN --mount=type=cache,target=/root/.cache/uv \
1611
RUN --mount=type=cache,target=/root/.cache/uv \
1712
uv sync --locked --no-editable --no-dev
1813

14+
RUN rm -rf ./dist
1915
RUN uv build
2016
RUN mv ./dist/sysdig_mcp_server-*.tar.gz /tmp/sysdig_mcp_server.tar.gz
2117

22-
# Final image without uv
23-
FROM python:3.12-slim
24-
# It is important to use the image that matches the builder, as the path to the
25-
# Python executable must be the same
18+
# Final image with UBI
19+
FROM quay.io/sysdig/sysdig-ubi:1
2620

27-
WORKDIR /app
21+
# Install Python 3.12 and git
22+
RUN dnf update -y && \
23+
dnf install -y python3.12 python3.12-pip git && \
24+
dnf clean all
25+
26+
# Create a non-root user
27+
RUN useradd -u 1001 -m appuser
28+
WORKDIR /home/appuser
2829

29-
RUN apt update && apt install -y git
3030
# Copy the application from the builder
31-
COPY --from=builder --chown=app:app /tmp/sysdig_mcp_server.tar.gz /app
31+
COPY --from=builder --chown=appuser:appuser /tmp/sysdig_mcp_server.tar.gz .
3232

33-
RUN pip install /app/sysdig_mcp_server.tar.gz
33+
# Install the application
34+
RUN python3.12 -m pip install --no-cache-dir sysdig_mcp_server.tar.gz
3435

35-
USER 1001:1001
36+
USER appuser
3637

3738
ENTRYPOINT ["sysdig-mcp-server"]

0 commit comments

Comments
 (0)