Run Dockerfile build, test and lint steps at nice -n 19 #64

Closed
clawbot wants to merge 1 commits from issue-63-nice-docker-steps into next
3 changed files with 15 additions and 7 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ RUN script/bootstrap
COPY . . COPY . .
RUN yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always RUN nice -n 19 yarn run prettier --check '**/*.md' --tab-width 4 --prose-wrap always
# Test phase, same shape and for the same reason. # Test phase, same shape and for the same reason.
# #
@@ -28,7 +28,7 @@ RUN script/bootstrap
COPY . . COPY . .
RUN echo "No tests defined." RUN nice -n 19 echo "No tests defined."
# Development environment, and the last stage: a plain `docker build .` # Development environment, and the last stage: a plain `docker build .`
# names no target and so builds this one. Nothing is wanted from the two # names no target and so builds this one. Nothing is wanted from the two
+4
View File
@@ -21,6 +21,10 @@ fmt-check, and commit.
# Completed Steps # Completed Steps
- 2026-09-29: Every `Dockerfile` step that builds, tests or lints now runs at
`nice -n 19`, per the owner's order on issue 63: the rule is one line in
`REPO_POLICIES.md`, and this repo's `Dockerfile` and the canonical Go
`Dockerfile` there follow it.
- 2026-09-08: Moved linting and testing into Docker as phases of the main - 2026-09-08: Moved linting and testing into Docker as phases of the main
`Dockerfile`, per the owner ruling on issue 40. `script/lint` and `Dockerfile`, per the owner ruling on issue 40. `script/lint` and
`script/test` build one phase each by name with `--no-cache` — the same answer `script/test` build one phase each by name with `--no-cache` — the same answer
+9 -5
View File
@@ -1,6 +1,6 @@
--- ---
title: Repository Policies title: Repository Policies
last_modified: 2026-09-08 last_modified: 2026-09-29
--- ---
This document covers repository structure, tooling, and workflow standards. Code This document covers repository structure, tooling, and workflow standards. Code
@@ -109,6 +109,10 @@ style conventions are in separate documents:
manifests (`package.json` + `yarn.lock`, `go.mod` + `go.sum`, etc.) before manifests (`package.json` + `yarn.lock`, `go.mod` + `go.sum`, etc.) before
running it. running it.
- Every `Dockerfile` `RUN` step that builds, tests or lints runs at the lowest
priority, as `RUN nice -n 19 <command>`; installs, downloads, copies and the
runtime `CMD`/`ENTRYPOINT` are not niced.
- **Linting and testing run in Docker, as phases of the `Dockerfile`.** There is - **Linting and testing run in Docker, as phases of the `Dockerfile`.** There is
no separate lint file. `script/lint` and `script/test` each build one phase no separate lint file. `script/lint` and `script/test` each build one phase
and nothing else: and nothing else:
@@ -171,7 +175,7 @@ style conventions are in separate documents:
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY . . COPY . .
RUN golangci-lint run --config .golangci.yml ./... RUN nice -n 19 golangci-lint run --config .golangci.yml ./...
# Test phase # Test phase
# golang:1.x-alpine, YYYY-MM-DD # golang:1.x-alpine, YYYY-MM-DD
@@ -180,9 +184,9 @@ style conventions are in separate documents:
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY . . COPY . .
RUN go test -timeout 90s -race -cover ./... || \ RUN nice -n 19 go test -timeout 90s -race -cover ./... || \
{ echo "--- Rerunning with -v for details ---"; \ { echo "--- Rerunning with -v for details ---"; \
go test -timeout 90s -race -v ./...; exit 1; } nice -n 19 go test -timeout 90s -race -v ./...; exit 1; }
# Build stage. Nothing is wanted from either phase above; the copies # Build stage. Nothing is wanted from either phase above; the copies
# are what make BuildKit build them first, so this stage cannot run # are what make BuildKit build them first, so this stage cannot run
@@ -197,7 +201,7 @@ style conventions are in separate documents:
COPY . . COPY . .
ARG VERSION=dev ARG VERSION=dev
RUN CGO_ENABLED=0 go build -trimpath \ RUN CGO_ENABLED=0 nice -n 19 go build -trimpath \
-ldflags="-s -w -X main.Version=${VERSION}" \ -ldflags="-s -w -X main.Version=${VERSION}" \
-o /app ./cmd/app/ -o /app ./cmd/app/