From a3d311009fbd6ce350428ce5bfcdce1517185b1f Mon Sep 17 00:00:00 2001 From: Aykhan Shahsuvarov Date: Sat, 10 Jan 2026 18:14:33 +0400 Subject: [PATCH] Add docker-build task and fix terminal colors in container --- Dockerfile | 5 ++++- Taskfile.yaml | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 066851c..286a395 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG GO_VERSION=required +ARG GO_VERSION=1.25.5 FROM docker.io/library/golang:${GO_VERSION}-alpine AS builder @@ -22,6 +22,9 @@ RUN --mount=type=bind,source=./,target=./ \ FROM gcr.io/distroless/static-debian12:latest +ENV TERM=xterm-256color +ENV COLORTERM=truecolor + WORKDIR / COPY --from=builder /sarin /sarin diff --git a/Taskfile.yaml b/Taskfile.yaml index 66204b7..a125675 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -70,3 +70,22 @@ tasks: - rm -f {{.GOLANGCI}} - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b {{.BIN_DIR}} {{.GOLANGCI_LINT_VERSION}} - mv {{.BIN_DIR}}/golangci-lint {{.GOLANGCI}} + + docker-build: + desc: Build the Docker image. + vars: + IMAGE_NAME: '{{.IMAGE_NAME | default "sarin"}}' + TAG: '{{.TAG | default "latest"}}' + GO_VERSION: '{{.GO_VERSION | default ""}}' + VERSION: + sh: git describe --tags --always + GIT_COMMIT: + sh: git rev-parse HEAD + cmds: + - >- + docker build + {{if .GO_VERSION}}--build-arg GO_VERSION={{.GO_VERSION}}{{end}} + --build-arg VERSION={{.VERSION}} + --build-arg GIT_COMMIT={{.GIT_COMMIT}} + -t {{.IMAGE_NAME}}:{{.TAG}} + .