Block a user
mcpo-grafana (latest)
Published 2025-09-10 23:41:12 -07:00 by sudacode
Installation
docker pull gitea.suda.codes/sudacode/mcpo-grafana:latestsha256:47b1e920e9d756e445e99916962a60ceae9f6db5cac157892d511e71e7a8ba22
Images
| Digest | OS / Arch | Size |
|---|---|---|
| e4df69f9d9 | linux/amd64 | 79 MiB |
| 90e7b03c56 | linux/arm64 | 78 MiB |
Image Layers ( linux/amd64)
| # debian.sh --arch 'amd64' out/ 'trixie' '@1757289600' |
| ENV PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| ENV LANG=C.UTF-8 |
| RUN /bin/sh -c set -eux; apt-get update; apt-get install -y --no-install-recommends ca-certificates netbase tzdata ; apt-get dist-clean # buildkit |
| ENV GPG_KEY=7169605F62C751356D054A26A821E680E5FA6305 |
| ENV PYTHON_VERSION=3.12.11 |
| ENV PYTHON_SHA256=c30bb24b7f1e9a19b11b55a546434f74e739bb4c271a3e3a80ff4380d49f7adb |
| RUN /bin/sh -c set -eux; savedAptMark="$(apt-mark showmanual)"; apt-get update; apt-get install -y --no-install-recommends dpkg-dev gcc gnupg libbluetooth-dev libbz2-dev libc6-dev libdb-dev libffi-dev libgdbm-dev liblzma-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev make tk-dev uuid-dev wget xz-utils zlib1g-dev ; wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz"; echo "$PYTHON_SHA256 *python.tar.xz" | sha256sum -c -; wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc"; GNUPGHOME="$(mktemp -d)"; export GNUPGHOME; gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys "$GPG_KEY"; gpg --batch --verify python.tar.xz.asc python.tar.xz; gpgconf --kill all; rm -rf "$GNUPGHOME" python.tar.xz.asc; mkdir -p /usr/src/python; tar --extract --directory /usr/src/python --strip-components=1 --file python.tar.xz; rm python.tar.xz; cd /usr/src/python; gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; ./configure --build="$gnuArch" --enable-loadable-sqlite-extensions --enable-optimizations --enable-option-checking=fatal --enable-shared $(test "${gnuArch%%-*}" != 'riscv64' && echo '--with-lto') --with-ensurepip ; nproc="$(nproc)"; EXTRA_CFLAGS="$(dpkg-buildflags --get CFLAGS)"; LDFLAGS="$(dpkg-buildflags --get LDFLAGS)"; LDFLAGS="${LDFLAGS:--Wl},--strip-all"; arch="$(dpkg --print-architecture)"; arch="${arch##*-}"; case "$arch" in amd64|arm64) EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"; ;; i386) ;; *) EXTRA_CFLAGS="${EXTRA_CFLAGS:-} -fno-omit-frame-pointer"; ;; esac; make -j "$nproc" "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" "LDFLAGS=${LDFLAGS:-}" ; rm python; make -j "$nproc" "EXTRA_CFLAGS=${EXTRA_CFLAGS:-}" "LDFLAGS=${LDFLAGS:--Wl},-rpath='\$\$ORIGIN/../lib'" python ; make install; cd /; rm -rf /usr/src/python; find /usr/local -depth \( \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name 'libpython*.a' \) \) \) -exec rm -rf '{}' + ; ldconfig; apt-mark auto '.*' > /dev/null; apt-mark manual $savedAptMark; find /usr/local -type f -executable -not \( -name '*tkinter*' \) -exec ldd '{}' ';' | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); printf "*%s\n", so }' | sort -u | xargs -rt dpkg-query --search | awk 'sub(":$", "", $1) { print $1 }' | sort -u | xargs -r apt-mark manual ; apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; apt-get dist-clean; export PYTHONDONTWRITEBYTECODE=1; python3 --version; pip3 --version # buildkit |
| RUN /bin/sh -c set -eux; for src in idle3 pip3 pydoc3 python3 python3-config; do dst="$(echo "$src" | tr -d 3)"; [ -s "/usr/local/bin/$src" ]; [ ! -e "/usr/local/bin/$dst" ]; ln -svT "$src" "/usr/local/bin/$dst"; done # buildkit |
| CMD ["python3"] |
| RUN /bin/sh -c set -eux; apt-get update; apt-get install -y --no-install-recommends ca-certificates curl tar gosu; rm -rf /var/lib/apt/lists/* # buildkit |
| RUN /bin/sh -c pip install --no-cache-dir mcpo # buildkit |
| WORKDIR /app |
| COPY VERSION /app/VERSION # buildkit |
| ARG MCP_GRAFANA_VERSION |
| ENV UUID=1000 GUID=1000 MCP_GRAFANA_VERSION= |
| ENV HOME=/app |
| ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin |
| RUN |1 MCP_GRAFANA_VERSION= /bin/sh -c set -eux; version="${MCP_GRAFANA_VERSION:-}"; if [ -z "$version" ] && [ -f /app/VERSION ]; then version="$(cat /app/VERSION)"; fi; if [ -z "$version" ]; then version="v0.6.5"; fi; arch="$(uname -m)"; case "$arch" in x86_64|amd64) asset_arch="x86_64" ;; aarch64|arm64) asset_arch="arm64" ;; *) echo "Unsupported architecture: $arch"; exit 1 ;; esac; url="https://github.com/grafana/mcp-grafana/releases/download/${version}/mcp-grafana_Linux_${asset_arch}.tar.gz"; tmp="/tmp/mcp-grafana.tar.gz"; curl -fsSL -o "$tmp" "$url"; mkdir -p /usr/local/bin; tar -xzf "$tmp" -C /usr/local/bin mcp-grafana || tar -xzf "$tmp" -C /usr/local/bin; chmod +x /usr/local/bin/mcp-grafana; rm -f "$tmp"; /usr/local/bin/mcp-grafana -h >/dev/null 2>&1 || true # buildkit |
| EXPOSE map[8001/tcp:{}] |
| RUN |1 MCP_GRAFANA_VERSION= /bin/sh -c set -eux; cat > /entrypoint.sh <<'EOF' #!/bin/sh set -eu target_uid="${UUID:-1000}" target_gid="${GUID:-1000}" user_name="appuser" group_name="appgroup" # Ensure group exists (by GID), prefer existing group name if present if getent group "$target_gid" >/dev/null 2>&1; then group_name="$(getent group "$target_gid" | cut -d: -f1)" else groupadd -g "$target_gid" "$group_name" fi # Ensure user exists with requested UID and primary GID if id -u "$user_name" >/dev/null 2>&1; then usermod -u "$target_uid" -g "$target_gid" "$user_name" || true else useradd -u "$target_uid" -g "$target_gid" -m -s /usr/sbin/nologin "$user_name" fi chown -R "$target_uid":"$target_gid" /app || true exec gosu "$user_name" env \ GRAFANA_URL="${GRAFANA_URL:-}" \ GRAFANA_SERVICE_ACCOUNT_TOKEN="${GRAFANA_SERVICE_ACCOUNT_TOKEN:-}" \ mcpo --port 8001 -- mcp-grafana -t stdio EOF # buildkit |
| RUN |1 MCP_GRAFANA_VERSION= /bin/sh -c chmod +x /entrypoint.sh # buildkit |
| ENTRYPOINT ["/entrypoint.sh"] |