Skip to content

Commit 56388b6

Browse files
Merge pull request #189 from AjayJagan/konflux-dockerfile-update
(feat): Update dockerfile to support multi-arch builds
2 parents d497e63 + 8610a7d commit 56388b6

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

backend/Dockerfile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ RUN GO111MODULE=on CGO_ENABLED=1 GOEXPERIMENT=strictfipsruntime go build -tags s
3636

3737
# 2. Compile preloaded pipeline samples
3838
FROM registry.access.redhat.com/ubi9/python-39:9.5 AS compiler
39+
40+
ARG TARGETOS TARGETARCH
41+
3942
USER root
4043
RUN dnf install -y python3-setuptools jq
4144
RUN wget https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py
@@ -44,10 +47,10 @@ RUN python3 -m pip install -r requirements.txt --no-cache-dir
4447

4548
# Downloading Argo CLI so that the samples are validated
4649
ENV ARGO_VERSION=v3.5.14
47-
RUN curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-linux-amd64.gz && \
48-
gunzip argo-linux-amd64.gz && \
49-
chmod +x argo-linux-amd64 && \
50-
mv ./argo-linux-amd64 /usr/local/bin/argo
50+
RUN curl -sLO https://github.com/argoproj/argo-workflows/releases/download/${ARGO_VERSION}/argo-${TARGETOS:-linux}-${TARGETARCH:-amd64}.gz && \
51+
gunzip argo-${TARGETOS:-linux}-${TARGETARCH:-amd64}.gz && \
52+
chmod +x argo-${TARGETOS:-linux}-${TARGETARCH:-amd64} && \
53+
mv ./argo-${TARGETOS:-linux}-${TARGETARCH:-amd64} /usr/local/bin/argo
5154

5255
WORKDIR /
5356
COPY ./samples /samples

backend/Dockerfile.driver

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ FROM registry.access.redhat.com/ubi9/go-toolset:1.23 AS builder
2020

2121
## Build args to be used at this step
2222
ARG SOURCE_CODE
23+
ARG TARGETARCH
2324

2425
## Switch to root as required for some operations
2526
USER root
@@ -34,7 +35,7 @@ RUN GO111MODULE=on go mod download
3435
# Copy the source
3536
COPY ${SOURCE_CODE}/ ./
3637

37-
RUN GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GOEXPERIMENT=strictfipsruntime go build -tags 'netgo strictfipsruntime' -o /bin/driver ./backend/src/v2/cmd/driver/*.go
38+
RUN GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH:-amd64} GOEXPERIMENT=strictfipsruntime go build -tags 'netgo strictfipsruntime' -o /bin/driver ./backend/src/v2/cmd/driver/*.go
3839

3940
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5
4041

backend/Dockerfile.launcher

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FROM registry.access.redhat.com/ubi9/go-toolset:1.23 AS builder
2222

2323
## Build args to be used at this step
2424
ARG SOURCE_CODE
25+
ARG TARGETARCH
2526

2627
## Switch to root as required for some operations
2728
USER root
@@ -36,8 +37,8 @@ RUN GO111MODULE=on go mod download
3637
# Copy the source
3738
COPY ${SOURCE_CODE}/ ./
3839

39-
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags netgo -ldflags '-extldflags "-static"' -o /bin/launcher-v2 ./backend/src/v2/cmd/launcher-v2/*.go
40-
RUN GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=amd64 GOEXPERIMENT=strictfipsruntime go build -tags 'netgo strictfipsruntime' -o /bin/launcher-v2-fips ./backend/src/v2/cmd/launcher-v2/*.go
40+
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH:-amd64} go build -tags netgo -ldflags '-extldflags "-static"' -o /bin/launcher-v2 ./backend/src/v2/cmd/launcher-v2/*.go
41+
RUN GO111MODULE=on CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH:-amd64} GOEXPERIMENT=strictfipsruntime go build -tags 'netgo strictfipsruntime' -o /bin/launcher-v2-fips ./backend/src/v2/cmd/launcher-v2/*.go
4142

4243
FROM registry.access.redhat.com/ubi9/ubi-minimal:9.5
4344

0 commit comments

Comments
 (0)