Duplicate build-stage names

Use a unique name for each FROM stage.

Description

A stage name must identify one FROM stage. Both the Go and Node stages in the first excerpt use build.

Potential impact

A duplicate name makes stage references ambiguous and can stop the build.

Remediation

Give the stages unique names such as go-builder and web-builder. Update each FROM or COPY --from that uses the old name.

Examples

Set GO_BUILD_IMAGE to a supported image compatible with the project. These excerpts omit the source files and dependency setup.

Before

dockerfile
ARG GO_BUILD_IMAGE
FROM ${GO_BUILD_IMAGE} AS build
RUN go build -o /out/app .

FROM node:22 AS build
RUN npm ci

After

dockerfile
ARG GO_BUILD_IMAGE
FROM ${GO_BUILD_IMAGE} AS go-builder
RUN go build -o /out/app .

FROM node:22 AS web-builder
RUN npm ci

References