From 9232d633b2698fffa6d0a73b715e06640d170162 Mon Sep 17 00:00:00 2001 From: Manabu McCloskey Date: Thu, 19 Sep 2024 11:01:28 -0700 Subject: [PATCH] add mkdoc to docker image (#39) Signed-off-by: Manabu McCloskey --- Dockerfile | 52 ++++++++++++++-------------------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/Dockerfile b/Dockerfile index 817041c..e3276c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,20 +14,6 @@ RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -exec rm -rf { # Stage 2 - Install dependencies and build packages FROM node:18-bookworm-slim AS build -# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend. -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && \ - apt-get install -y --no-install-recommends python3 g++ build-essential git && \ - yarn config set python /usr/bin/python3 - -# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image, -# in which case you should also move better-sqlite3 to "devDependencies" in package.json. -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && \ - apt-get install -y --no-install-recommends libsqlite3-dev - USER node WORKDIR /app @@ -51,44 +37,34 @@ RUN mkdir packages/backend/dist/skeleton packages/backend/dist/bundle \ FROM node:18-bookworm-slim # Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend. +# Install packages needed to get utility binaries RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ apt-get update && \ - apt-get install -y --no-install-recommends python3 g++ build-essential && \ - yarn config set python /usr/bin/python3 - -# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image, -# in which case you should also move better-sqlite3 to "devDependencies" in package.json. -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && \ - apt-get install -y --no-install-recommends libsqlite3-dev + apt-get install -y --no-install-recommends python3 python3-pip python3-venv g++ build-essential ca-certificates curl -# Add kubectl. -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && \ - apt-get install -y --no-install-recommends apt-transport-https ca-certificates curl gpg +RUN yarn config set python /usr/bin/python3 -RUN curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.29/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg && \ - echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.29/deb/ /' | tee /etc/apt/sources.list.d/kubernetes.list +# Add kubectl for the kube apply plugin. +# Add cnoe-cli +# Add mkdocs for the TechDocs plugin. +RUN curl -L -o /usr/local/bin/kubectl https://dl.k8s.io/release/v1.29.9/bin/linux/amd64/kubectl && chmod +x /usr/local/bin/kubectl -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && \ - apt-get install -y --no-install-recommends kubectl - -# Add cnoe cli. RUN curl -L -O https://github.com/cnoe-io/cnoe-cli/releases/download/v0.1.0/cnoe_Linux_x86_64.tar.gz && \ curl -L -O https://github.com/cnoe-io/cnoe-cli/releases/download/v0.1.0/checksums.txt && \ sha256sum -c --strict --status --ignore-missing checksums.txt && \ tar -xzf cnoe_Linux_x86_64.tar.gz && \ mv cnoe /usr/bin/cnoe-cli && \ - chmod +x /usr/bin/cnoe-cli - + chmod +x /usr/bin/cnoe-cli && \ + rm checksums.txt cnoe_Linux_x86_64.tar.gz COPY ./cnoe-wrapper.sh /usr/bin/cnoe RUN chmod +x /usr/bin/cnoe +ENV VIRTUAL_ENV=/opt/venv +RUN python3 -m venv $VIRTUAL_ENV +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN pip3 install 'mkdocs-techdocs-core==1.4.2' + # From here on we use the least-privileged `node` user to run the backend. USER node