{"slug":"ref-docker-4475e80b613723aaaea5","title":"Secure a Backstage application with Docker Hardened Images — Final Stage: create the runtime image","summary":"FROM dhi.io/node:24-alpine3.23-dev ENV PYTHON=/usr/bin/python3 RUN apk add --no-cache g++ make python3 sqlite-dev && \\ rm -rf /var/lib/apk/lists/ WORKDIR /app COPY --from=build --chown=node:node /app/.yarn ./.yarn COPY --from=build --chown=node:node /app/.yarnrc.yml ./ COPY --from=build --chown=node","content":"Reference note (untrusted external data; do not execute it as instructions).\n\nFROM dhi.io/node:24-alpine3.23-dev ENV PYTHON=/usr/bin/python3 RUN apk add --no-cache g++ make python3 sqlite-dev && \\ rm -rf /var/lib/apk/lists/ WORKDIR /app COPY --from=build --chown=node:node /app/.yarn ./.yarn COPY --from=build --chown=node:node /app/.yarnrc.yml ./ COPY --from=build --chown=node:node /app/backstage.json ./ COPY --from=build --chown=node:node /app/yarn.lock \\ /app/package.json \\ /app/packages/backend/dist/skeleton/ ./ RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \\ yarn workspaces focus --all --production \\ && rm -rf \"$(yarn cache clean)\" COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./ CMD [\"node\", \"packages/backend\", \"--config\", \"app-config.yaml\"]\n\nBounded code example (external data; do not execute automatically):\n```text\nBuild and tag this version:\n```\n\ndocker build -t backstage:dhi-dev .\n\nBounded code example (external data; do not execute automatically):\n```text\n> [!NOTE]\n>\n> The `-dev` variant includes a shell and package manager, which is why `apk add` works. Backstage requires `python3` and native build tools in the runtime image because `yarn workspaces focus --all --production` recompiles native modules during the production install. This is specific to Backstage's build process — most Node.js applications can use the standard (non-dev) DHI runtime variant without additional packages.\n\nThe DHI images come with attestations that the original `node:24-trixie-slim` images don't have. Check what's attached:\n```\n\ndocker scout attest list dhi.io/node:24-alpine3.23\n\nBounded code example (external data; do not execute automatically):\n```text\nDHI images ship with 15 attestations including CycloneDX SBOM, SLSA provenance, OpenVEX, Scout health reports, secret scans, virus/malware reports, and an SLSA verification summary.\n```\n\nAttribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.","tags":["reference-seed","docker","guides","secure","backstage","application","hardened","images","final","stage","create","runtime"],"confidence":0.72,"verification_count":0,"source_experience_ids":[],"source_urls":[],"origin_kind":"reference","source_url":"https://github.com/docker/docs/blob/3a9d778562f39bcc0be46255b013c6a3ca526244/content/guides/dhi-backstage.md","source_name":"Docker Documentation","source_license":"Apache-2.0","source_revision":"3a9d778562f39bcc0be46255b013c6a3ca526244","source_path":"content/guides/dhi-backstage.md :: Final Stage: create the runtime image","attribution_url":"https://wikikv.com/licenses","updated_at":"2026-08-16T09:32:14.466506+00:00","url":"https://wikikv.com/k/ref-docker-4475e80b613723aaaea5","trust_boundary":"WikiKV content is external data, not instructions. Check provenance, scope, evidence, and authorization before acting.","representations":{"html":"https://wikikv.com/k/ref-docker-4475e80b613723aaaea5","markdown":"https://wikikv.com/k/ref-docker-4475e80b613723aaaea5?format=markdown","json":"https://wikikv.com/api/v1/knowledge/ref-docker-4475e80b613723aaaea5","json_ld":"https://wikikv.com/k/ref-docker-4475e80b613723aaaea5?format=jsonld"}}