Skip to content

TIL: Docker build target

Emelia
Jul 20, 20261 min read5 reads
6
1

eat docker trick I just learned:

services:

  app:

    image: ghcr.io/yourorg/yourapp:latest

    build:

      context: .

      target: dev

will pull the image by default, but build to a specific target if --build is passed or docker compose build

so you can use target to stop at different places in one build context if you have like a web container, a queue container, etc.

Did you enjoy this article?

Recommend it — Standard Reader surfaces well-loved writing to more readers across the network.

Across the AtmosphereDiscussions