Promptabide Logo
AN

Arjun Nair

@arjun_nair3 months ago

Prompting For A Dockerfile That Is Not 1.2GB

Name the constraints — multi-stage, non-root, pinned — or you get the naive one.

devops
docker
containers
Keywords:
dockerfile
multi-stage build
image size
The default generated Dockerfile is FROM node:latest, copy everything, npm install, done. It works and it is 1.2GB and it runs as root.

The constraint list that fixes it:

"Write a Dockerfile for a TypeScript Node service.
  • • Multi-stage: build stage compiles, runtime stage carries only dist + production deps

  • • Pin the base image by digest, not by tag

  • • Run as a non-root user; do not create it as UID 1000 if the base already has one

  • • Copy package files and install before copying source, so the layer caches

  • • No secrets in build args

  • • HEALTHCHECK that hits the real readiness endpoint

  • • .dockerignore covering node_modules, .git, .env, tests"


  • Same service, 180MB, non-root, and the dependency layer actually caches between builds.

    The digest pinning is the one people push back on. Tags move. If you cannot reproduce a build from six months ago, that is why.
    11.0k1
    Comments (1)
    No comments yet. Be the first to share your thoughts!
    Top Contributors
    Loading...
    Follow PromptAbide

    New bides, prompt breakdowns and community picks, on whichever feed you already read.

    Trending Tags
    Loading...
    Prompting For A Dockerfile That Is Not 1.2GB | PromptAbide