2025-01-10 11:12:03 +00:00
|
|
|
---
|
2024-12-19 11:38:57 +00:00
|
|
|
# https://taskfile.dev
|
|
|
|
|
|
2025-03-10 11:03:00 +00:00
|
|
|
version: "3"
|
2024-12-19 11:38:57 +00:00
|
|
|
|
|
|
|
|
vars:
|
2025-05-05 09:31:21 +00:00
|
|
|
DOCKERFILE: "build/Dockerfile"
|
2025-09-18 21:06:21 +00:00
|
|
|
BUILD_TIME:
|
|
|
|
|
sh: date -u +"%Y-%m-%dT%H:%M:%SZ"
|
|
|
|
|
GIT_SHORT_COMMIT:
|
|
|
|
|
sh: git rev-parse --short HEAD
|
2025-06-02 10:44:45 +00:00
|
|
|
GIT_VERSION:
|
2025-09-18 21:06:21 +00:00
|
|
|
sh: echo "$(date -u +"%Y%m%d.%H%M%S")-$(git rev-parse --short HEAD)"
|
2025-06-02 10:44:45 +00:00
|
|
|
GIT_COMMIT:
|
|
|
|
|
sh: git rev-parse HEAD
|
2024-12-19 11:38:57 +00:00
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
|
lint:
|
2026-05-21 19:40:04 +00:00
|
|
|
desc: "Lint the production Dockerfile with hadolint"
|
2024-12-19 11:38:57 +00:00
|
|
|
cmds:
|
2025-01-10 12:58:14 +00:00
|
|
|
- hadolint {{.DOCKERFILE}} -t none
|
2024-12-19 11:38:57 +00:00
|
|
|
build:
|
2026-05-21 19:40:04 +00:00
|
|
|
desc: "Build the production docker image tagged :latest and :<git-version>"
|
2025-03-10 11:03:00 +00:00
|
|
|
run: once
|
2025-06-02 10:44:45 +00:00
|
|
|
cmd: |
|
2025-06-11 12:01:04 +00:00
|
|
|
# Build with caching enabled
|
2025-06-02 10:44:45 +00:00
|
|
|
docker build \
|
|
|
|
|
--build-arg "GIT_VERSION={{.GIT_VERSION}}" \
|
|
|
|
|
--build-arg "GIT_COMMIT={{.GIT_COMMIT}}" \
|
2025-09-18 21:06:21 +00:00
|
|
|
--build-arg "BUILD_TIME={{.BUILD_TIME}}" \
|
2025-06-11 12:01:04 +00:00
|
|
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
|
|
|
|
-t {{.IMAGE_NAME}}:latest \
|
|
|
|
|
-t {{.IMAGE_NAME}}:{{.GIT_VERSION}} \
|
|
|
|
|
-f {{.DOCKERFILE}} .
|
2025-06-30 21:00:49 +00:00
|
|
|
build:debug:
|
2026-05-21 19:40:04 +00:00
|
|
|
desc: "Build the :debug docker image that includes the Delve debugger"
|
2025-06-30 21:00:49 +00:00
|
|
|
run: once
|
|
|
|
|
cmd: |
|
|
|
|
|
# Build debug image with Delve debugger
|
|
|
|
|
docker build \
|
|
|
|
|
--build-arg "GIT_VERSION={{.GIT_VERSION}}" \
|
|
|
|
|
--build-arg "GIT_COMMIT={{.GIT_COMMIT}}" \
|
2025-09-18 21:06:21 +00:00
|
|
|
--build-arg "BUILD_TIME={{.BUILD_TIME}}" \
|
2025-06-30 21:00:49 +00:00
|
|
|
-t {{.IMAGE_NAME}}:debug \
|
|
|
|
|
-f build/Dockerfile.debug .
|