Skip to content

Commit aa378a8

Browse files
authored
fix(image-build): change from emulation to cross-compile (eclipse-tractusx#181)
for building multi-platform images eclipse-tractusx/portal-backend#802 https://docs.docker.com/build/building/multi-platform https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support also improve dockerfiles by removing unnecessary base stage and aligning environment variables
1 parent c8f07b2 commit aa378a8

10 files changed

+15
-36
lines changed

.github/workflows/credential-expiry-app-docker.yml

-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ jobs:
5757
- name: Set up Docker Buildx
5858
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
5959

60-
- name: Set up QEMU
61-
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
62-
6360
- name: Docker meta
6461
id: meta
6562
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1

.github/workflows/migrations-docker.yml

-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ jobs:
5858
- name: Set up Docker Buildx
5959
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
6060

61-
- name: Set up QEMU
62-
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
63-
6461
- name: Docker meta
6562
id: meta
6663
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1

.github/workflows/processes-worker-docker.yml

-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ jobs:
5757
- name: Set up Docker Buildx
5858
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
5959

60-
- name: Set up QEMU
61-
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
62-
6360
- name: Docker meta
6461
id: meta
6562
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1

.github/workflows/release.yml

-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ jobs:
119119
- name: Set up Docker Buildx
120120
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
121121

122-
- name: Set up QEMU
123-
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
124-
125122
# Create SemVer or ref tags dependent of trigger event
126123
- name: Docker meta
127124
id: meta

.github/workflows/release_candidate.yml

-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ jobs:
6161
- name: Set up Docker Buildx
6262
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
6363

64-
- name: Set up QEMU
65-
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
66-
6764
- name: Docker meta
6865
id: meta
6966
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1

.github/workflows/service-docker.yml

-3
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ jobs:
5757
- name: Set up Docker Buildx
5858
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
5959

60-
- name: Set up QEMU
61-
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
62-
6360
- name: Docker meta
6461
id: meta
6562
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1

docker/Dockerfile-credential-expiry-app

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818
###############################################################
1919

20-
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS base
21-
22-
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine-amd64 AS publish
20+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS publish
21+
ARG TARGETARCH
2322
WORKDIR /
2423
COPY LICENSE NOTICE.md DEPENDENCIES /
2524
COPY src/ src/
2625
RUN dotnet restore "src/credentials/SsiCredentialIssuer.Expiry.App/SsiCredentialIssuer.Expiry.App.csproj"
2726
WORKDIR /src/credentials/SsiCredentialIssuer.Expiry.App
2827
RUN dotnet publish "SsiCredentialIssuer.Expiry.App.csproj" -c Release -o /app/publish
2928

30-
FROM base AS final
29+
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine
3130
ENV COMPlus_EnableDiagnostics=0
3231
WORKDIR /app
3332
COPY --from=publish /app/publish .

docker/Dockerfile-credential-issuer-migrations

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818
###############################################################
1919

20-
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS base
21-
22-
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine-amd64 AS publish
20+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS publish
21+
ARG TARGETARCH
2322
WORKDIR /
2423
COPY LICENSE NOTICE.md DEPENDENCIES /
2524
COPY /src/database /src/database
2625
COPY /src/processes/Processes.Worker.Library /src/processes/Processes.Worker.Library
2726
WORKDIR /src/database/SsiCredentialIssuer.Migrations
2827
RUN dotnet publish "SsiCredentialIssuer.Migrations.csproj" -c Release -o /migrations/publish
2928

30-
FROM base AS final
29+
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine
3130
ENV COMPlus_EnableDiagnostics=0
3231
WORKDIR /migrations
3332
COPY --from=publish /migrations/publish .

docker/Dockerfile-credential-issuer-processes-worker

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,16 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818
###############################################################
1919

20-
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine AS base
21-
22-
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine-amd64 AS publish
20+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS publish
21+
ARG TARGETARCH
2322
WORKDIR /
2423
COPY LICENSE NOTICE.md DEPENDENCIES /
2524
COPY src/ src/
2625
RUN dotnet restore "src/processes/Processes.Worker/Processes.Worker.csproj"
2726
WORKDIR /src/processes/Processes.Worker
2827
RUN dotnet publish "Processes.Worker.csproj" -c Release -o /app/publish
2928

30-
FROM base AS final
29+
FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine
3130
ENV COMPlus_EnableDiagnostics=0
3231
WORKDIR /app
3332
COPY --from=publish /app/publish .

docker/Dockerfile-credential-issuer-service

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@
1717
# SPDX-License-Identifier: Apache-2.0
1818
###############################################################
1919

20-
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base
21-
22-
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine-amd64 AS publish
20+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS publish
21+
ARG TARGETARCH
2322
WORKDIR /
2423
COPY LICENSE NOTICE.md DEPENDENCIES /
2524
COPY src/ src/
2625
WORKDIR /src/issuer/SsiCredentialIssuer.Service
2726
RUN dotnet publish "SsiCredentialIssuer.Service.csproj" -c Release -o /app/publish
2827

29-
FROM base AS final
30-
ENV COMPlus_EnableDiagnostics=0
28+
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine
29+
ENV \
30+
COMPlus_EnableDiagnostics=0 \
31+
ASPNETCORE_URLS=http://+:8080
3132
WORKDIR /app
3233
COPY --from=publish /app/publish .
33-
ENV ASPNETCORE_URLS http://+:8080
3434
EXPOSE 8080
3535
RUN chown -R 1000:3000 /app
3636
USER 1000:3000

0 commit comments

Comments
 (0)