dotnet publish inside Dockerfile doesn't work on 8.0-alpine #5333
-
I'm referencing the sample [here]. For my personal project, I have this in the build portion of my # syntax=docker/dockerfile:1.7-labs
# Following Microsoft's pattern shown here:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/dotnetapp/Dockerfile.alpine
# https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md
#
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build
ARG TARGETARCH
WORKDIR /source
# copy csproj and restore as distinct layers
COPY --parents *.props src/*/*.csproj ./
RUN dotnet restore src/Recyclarr.Cli -a $TARGETARCH
# copy and publish app and libraries
COPY . .
RUN dotnet publish src/Recyclarr.Cli -a $TARGETARCH --no-restore -o /app You can find this and more in my open source repo here. When I run
As far as I can tell, I'm doing exactly what the sample is doing. I also added the I'm completely lost here. What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Do you have a .dockerignore? The
|
Beta Was this translation helpful? Give feedback.
-
TIL https://docs.docker.com/reference/dockerfile/#copy---parents |
Beta Was this translation helpful? Give feedback.
Do you have a .dockerignore? The
COPY . .
can be interfering if you don't and you have built locally. From https://learn.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1005