From db7fd1aabda18ed39c5afbca29adcb279f37d785 Mon Sep 17 00:00:00 2001
From: Martin Weise <martin.weise@tuwien.ac.at>
Date: Mon, 14 Apr 2025 14:09:15 +0200
Subject: [PATCH] 1st attempt in multiarch build

Signed-off-by: Martin Weise <martin.weise@tuwien.ac.at>
---
 dbrepo-analyse-service/Dockerfile     | 2 +-
 dbrepo-dashboard-service/Dockerfile   | 2 +-
 dbrepo-data-service/Dockerfile        | 6 +++---
 dbrepo-metadata-service/Dockerfile    | 6 +++---
 dbrepo-search-service/Dockerfile      | 2 +-
 dbrepo-search-service/init.Dockerfile | 2 +-
 dbrepo-ui/Dockerfile                  | 6 ++++--
 7 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/dbrepo-analyse-service/Dockerfile b/dbrepo-analyse-service/Dockerfile
index 26ea3ce65c..df313ec934 100644
--- a/dbrepo-analyse-service/Dockerfile
+++ b/dbrepo-analyse-service/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.11-alpine3.21
+FROM --platform=$BUILDPLATFORM python:3.11-alpine3.21
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 RUN apk --no-cache add \
diff --git a/dbrepo-dashboard-service/Dockerfile b/dbrepo-dashboard-service/Dockerfile
index e739245d30..62caad802f 100644
--- a/dbrepo-dashboard-service/Dockerfile
+++ b/dbrepo-dashboard-service/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.11-alpine3.21
+FROM --platform=$BUILDPLATFORM python:3.11-alpine3.21
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 RUN apk add --no-cache \
diff --git a/dbrepo-data-service/Dockerfile b/dbrepo-data-service/Dockerfile
index 7468f1c568..769014f61b 100644
--- a/dbrepo-data-service/Dockerfile
+++ b/dbrepo-data-service/Dockerfile
@@ -1,9 +1,9 @@
 ###### FIRST STAGE ######
-FROM dbrepo-core:build AS dependency
+FROM --platform=$BUILDPLATFORM dbrepo-core:build AS dependency
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 ###### SECOND STAGE ######
-FROM maven:3-amazoncorretto-17 AS build
+FROM --platform=$BUILDPLATFORM maven:3-amazoncorretto-17 AS build
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 COPY ./pom.xml ./
@@ -21,7 +21,7 @@ COPY ./services ./services
 RUN mvn -fn clean package -DskipTests
 
 ###### THIRD STAGE ######
-FROM amazoncorretto:17-alpine3.19 AS runtime
+FROM --platform=$BUILDPLATFORM amazoncorretto:17-alpine3.19 AS runtime
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 RUN apk add --no-cache curl bash jq
diff --git a/dbrepo-metadata-service/Dockerfile b/dbrepo-metadata-service/Dockerfile
index 8d01865d85..f034640e6a 100644
--- a/dbrepo-metadata-service/Dockerfile
+++ b/dbrepo-metadata-service/Dockerfile
@@ -1,9 +1,9 @@
 ###### FIRST STAGE ######
-FROM dbrepo-core:build AS dependency
+FROM --platform=$BUILDPLATFORM dbrepo-core:build AS dependency
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 ###### SECOND STAGE ######
-FROM maven:3-amazoncorretto-17 AS build
+FROM --platform=$BUILDPLATFORM maven:3-amazoncorretto-17 AS build
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 COPY ./pom.xml ./
@@ -22,7 +22,7 @@ COPY ./services ./services
 RUN mvn -fn clean package -DskipTests
 
 ###### THIRD STAGE ######
-FROM amazoncorretto:17-alpine3.19 AS runtime
+FROM --platform=$BUILDPLATFORM amazoncorretto:17-alpine3.19 AS runtime
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 RUN apk add --no-cache curl bash jq
diff --git a/dbrepo-search-service/Dockerfile b/dbrepo-search-service/Dockerfile
index 0366024576..1d0862a9e5 100644
--- a/dbrepo-search-service/Dockerfile
+++ b/dbrepo-search-service/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.11-alpine3.21
+FROM --platform=$BUILDPLATFORM python:3.11-alpine3.21
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 RUN apk add --no-cache \
diff --git a/dbrepo-search-service/init.Dockerfile b/dbrepo-search-service/init.Dockerfile
index cf4cb94d85..2099df48cc 100644
--- a/dbrepo-search-service/init.Dockerfile
+++ b/dbrepo-search-service/init.Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.11-alpine3.21
+FROM --platform=$BUILDPLATFORM python:3.11-alpine3.21
 LABEL org.opencontainers.image.authors="martin.weise@tuwien.ac.at"
 
 RUN apk add --no-cache \
diff --git a/dbrepo-ui/Dockerfile b/dbrepo-ui/Dockerfile
index f76a3d7504..966b7dbb3d 100644
--- a/dbrepo-ui/Dockerfile
+++ b/dbrepo-ui/Dockerfile
@@ -1,4 +1,5 @@
-FROM oven/bun:1.1.40-alpine AS build
+###### FIRST STAGE ######
+FROM --platform=$BUILDPLATFORM oven/bun:1.1.40-alpine AS build
 
 WORKDIR /app
 
@@ -25,7 +26,8 @@ COPY ./nuxt.config.ts ./nuxt.config.ts
 
 RUN bun run build
 
-FROM node:22.9.0-alpine3.20 AS runtime
+###### SECOND STAGE ######
+FROM --platform=$BUILDPLATFORM node:22.9.0-alpine3.20 AS runtime
 
 ARG APP_VERSION="latest"
 ARG COMMIT=""
-- 
GitLab