Common Patterns

15 cards

Review this deck
All cards in this deck

stage builder: FROM <full-sdk-image> AS builder

Common Patterns

stage builder: COPY package*.json / requirements.txt

Common Patterns

stage builder: RUN npm ci / pip install

Common Patterns

stage builder: COPY source code

Common Patterns

stage builder: RUN npm run build / go build / pip install --prefix

Common Patterns

stage runtime: FROM <slim-image> AS runtime

Common Patterns

stage runtime: COPY --from=builder artifacts only

Common Patterns

stage runtime: USER non-root

Common Patterns

stage runtime: CMD exec form

Common Patterns

rule 1

expire untagged images after 7 days

rule 2

keep at most 10 tagged images with prefix "v"

Code/image

no secrets

ECS Task Def

secrets[] points to a Secrets Manager ARN

ECS Agent

fetches the secret and injects it into the container's env vars

Container startup

receives DATABASE_URL, API_KEY via environment

Common Patterns – Flashcards – Docker | Học Dev