mirror of
https://github.com/dockersamples/example-voting-app.git
synced 2026-05-22 01:12:50 +00:00
Added fix
This commit is contained in:
@@ -1,37 +1,34 @@
|
||||
# because of dotnet, we always build on amd64, and target platforms in cli
|
||||
# dotnet doesn't support QEMU for building or running.
|
||||
# (errors common in arm/v7 32bit) https://github.com/dotnet/dotnet-docker/issues/1537
|
||||
# https://hub.docker.com/_/microsoft-dotnet
|
||||
# hadolint ignore=DL3029
|
||||
# to build for a different platform than your host, use --platform=<platform>
|
||||
# for example, if you were on Intel (amd64) and wanted to build for ARM, you would use:
|
||||
# docker buildx build --platform "linux/arm64/v8" .
|
||||
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:7.0 as build
|
||||
ARG TARGETPLATFORM
|
||||
ARG BUILDPLATFORM
|
||||
RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
|
||||
|
||||
WORKDIR /source
|
||||
|
||||
COPY *.csproj .
|
||||
|
||||
RUN case ${TARGETPLATFORM} in \
|
||||
"linux/amd64") ARCH=x64 ;; \
|
||||
"linux/arm64") ARCH=arm64 ;; \
|
||||
"linux/arm64/v8") ARCH=arm64 ;; \
|
||||
"linux/arm/v7") ARCH=arm ;; \
|
||||
"linux/amd64") ARCH=x64 ;; \
|
||||
"linux/arm64") ARCH=arm64 ;; \
|
||||
"linux/arm64/v8") ARCH=arm64 ;; \
|
||||
"linux/arm/v7") ARCH=arm ;; \
|
||||
esac \
|
||||
&& dotnet restore -r linux-${ARCH}
|
||||
&& dotnet restore -r linux-${ARCH} \
|
||||
&& dotnet add package System.Drawing.Common -v 5.0.3
|
||||
|
||||
COPY . .
|
||||
RUN case ${TARGETPLATFORM} in \
|
||||
"linux/amd64") ARCH=x64 ;; \
|
||||
"linux/arm64") ARCH=arm64 ;; \
|
||||
"linux/arm64/v8") ARCH=arm64 ;; \
|
||||
"linux/arm/v7") ARCH=arm ;; \
|
||||
|
||||
RUN case ${TARGETPLATFORM} in \
|
||||
"linux/amd64") ARCH=x64 ;; \
|
||||
"linux/arm64") ARCH=arm64 ;; \
|
||||
"linux/arm64/v8") ARCH=arm64 ;; \
|
||||
"linux/arm/v7") ARCH=arm ;; \
|
||||
esac \
|
||||
&& dotnet publish -c release -o /app -r linux-${ARCH} --self-contained false --no-restore
|
||||
&& dotnet publish -c release -o /app -r linux-${ARCH} --self-contained false --no-restore --framework net7.0
|
||||
|
||||
|
||||
# app image
|
||||
FROM mcr.microsoft.com/dotnet/runtime:7.0
|
||||
WORKDIR /app
|
||||
COPY --from=build /app .
|
||||
ENTRYPOINT ["dotnet", "Worker.dll"]
|
||||
ENTRYPOINT ["dotnet", "Worker.dll"]
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<TargetFrameworks>net7.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>linux-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
|
||||
<PackageReference Include="Npgsql" Version="4.1.9" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Npgsql" Version="5.0.1" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user