Skip to content

Taskfile.docker

FieldValue
TypeSkill Resource
Source~/.copilot/skills/go-task/templates/Taskfile.docker.yml
DescriptionNot specified

Source Content

version: '3'
# =============================================================================
# Docker task group. Included by the root Taskfile under the `docker:`
# namespace, so commands are called as:
#
# task docker:build
# task docker:run
# task docker:up
# task docker:down
# task docker:push
#
# Splitting Docker out keeps the root Taskfile a readable index. Mirror this
# file for other tool families (Taskfile.kubectl.yml, Taskfile.db.yml).
# =============================================================================
vars:
# 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"}}'
tasks:
build:
desc: Build the container image (incremental — skipped when nothing changed)
# Rebuild only when the Dockerfile or any source it copies changes.
sources:
- Dockerfile
- '**/*.go'
- '**/*.ts'
- '**/*.tsx'
- package.json
cmds:
- docker build -t {{.IMAGE}}:{{.TAG}} .
run:
desc: Run the image locally on PORT (extra docker flags pass through after --)
deps: [build]
cmds:
- docker run --rm -p {{.PORT | default "3000"}}:{{.PORT | default "3000"}} {{.CLI_ARGS}} {{.IMAGE}}:{{.TAG}}
up:
desc: Start the local docker-compose stack in the background
preconditions:
- sh: test -f compose.yaml || test -f docker-compose.yml
msg: no compose.yaml / docker-compose.yml found in this project
cmds:
- docker compose up -d
down:
desc: Stop the local docker-compose stack
cmds:
- docker compose down
push:
desc: Push the built image to its registry (confirms first — it leaves your machine)
deps: [build]
prompt: Push {{.IMAGE}}:{{.TAG}} to the registry?
cmds:
- docker push {{.IMAGE}}:{{.TAG}}