Skip to content

Commit

Permalink
ci: Move IMAGE_TAG Dockerfile ARG into build phase (#15983)
Browse files Browse the repository at this point in the history
In order to access the variable ${IMAGE_TAG} that is provided as `--build-arg IMAGE_TAG=x.x.x` in the `docker build` command, the `ARG` definition in the Dockerfile needs to be inside the build step block, otherwise it is empty.

Signed-off-by: Christian Haudum <[email protected]>
  • Loading branch information
chaudum authored Jan 28, 2025
1 parent bd1ea23 commit ed061b3
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clients/cmd/promtail/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG GO_VERSION=1.23
ARG IMAGE_TAG

FROM golang:${GO_VERSION}-bookworm as build
ARG IMAGE_TAG

COPY . /src/loki
WORKDIR /src/loki
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki-canary-boringcrypto/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GO_VERSION=1.23
ARG IMAGE_TAG
FROM golang:${GO_VERSION} as build
ARG IMAGE_TAG

COPY . /src/loki
WORKDIR /src/loki
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki-canary/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG GO_VERSION=1.23
ARG IMAGE_TAG
FROM golang:${GO_VERSION} AS build
ARG IMAGE_TAG

COPY . /src/loki
WORKDIR /src/loki
Expand Down
2 changes: 1 addition & 1 deletion cmd/loki/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
ARG GO_VERSION=1.23
ARG IMAGE_TAG

# UI build stage
FROM node:20-alpine AS ui-builder
Expand All @@ -10,6 +9,7 @@ RUN make -C pkg/dataobj/explorer/ui build

# Go build stage
FROM golang:${GO_VERSION} AS build
ARG IMAGE_TAG
COPY . /src/loki
COPY --from=ui-builder /src/loki/pkg/dataobj/explorer/dist /src/loki/pkg/dataobj/explorer/dist
WORKDIR /src/loki
Expand Down
3 changes: 2 additions & 1 deletion cmd/querytee/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
ARG GO_VERSION=1.23
FROM golang:${GO_VERSION} as build
ARG IMAGE_TAG

COPY . /src/loki
WORKDIR /src/loki
RUN make clean && make BUILD_IN_CONTAINER=false loki-querytee
RUN make clean && make BUILD_IN_CONTAINER=false IMAGE_TAG=${IMAGE_TAG} loki-querytee

FROM gcr.io/distroless/static:debug
COPY --from=build /src/loki/cmd/querytee/querytee /usr/bin/querytee
Expand Down

0 comments on commit ed061b3

Please sign in to comment.