# =============================================================================
# Docker task group. Included by the root Taskfile under the `docker:`
# namespace, so commands are called as:
# Splitting Docker out keeps the root Taskfile a readable index. Mirror this
# file for other tool families (Taskfile.kubectl.yml, Taskfile.db.yml).
# =============================================================================
# The image coordinates. Override per call, e.g.
# task docker:build IMAGE=ghcr.io/dmwd-io/app TAG=v1.2.3
IMAGE: '{{.IMAGE | default "app"}}'
TAG: '{{.TAG | default "latest"}}'
desc: Build the container image (incremental — skipped when nothing changed)
# Rebuild only when the Dockerfile or any source it copies changes.
- docker build -t {{.IMAGE}}:{{.TAG}} .
desc: Run the image locally on PORT (extra docker flags pass through after --)
- docker run --rm -p {{.PORT | default "3000"}}:{{.PORT | default "3000"}} {{.CLI_ARGS}} {{.IMAGE}}:{{.TAG}}
desc: Start the local docker-compose stack in the background
- sh: test -f compose.yaml || test -f docker-compose.yml
msg: no compose.yaml / docker-compose.yml found in this project
desc: Stop the local docker-compose stack
desc: Push the built image to its registry (confirms first — it leaves your machine)
prompt: Push {{.IMAGE}}:{{.TAG}} to the registry?
- docker push {{.IMAGE}}:{{.TAG}}