Open Andymnm opened 1 month ago
flag break -o in command dotnet publish -c $CONF -a $TARGETARCH --output /app
dotnet publish -c $CONF -a $TARGETARCH --output /app
INFO[0793] Running: [/bin/sh -c dotnet publish -c $CONF -a $TARGETARCH --output /app] MSBUILD : error MSB1001: Unknown switch. Full command line: '/usr/share/dotnet/sdk/8.0.303/MSBuild.dll -maxcpucount -verbosity:m -nologo -restore -target:Publish --property:_IsPublishing=true -property:Configuration=Release -property:RuntimeIdentifier=linux-musl---output -property:DOTNET_CLI_DISABLE_PUBLISH_AND_PACK_RELEASE=true /app -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/share/dotnet/sdk/8.0.303/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/usr/share/dotnet/sdk/8.0.303/dotnet.dll' Switches appended by response files: Switch: /app For switch syntax, type "MSBuild -help"
Dockerfile
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build ARG TARGETARCH ARG CONF=Release WORKDIR /source COPY *.csproj . RUN dotnet restore --no-cache COPY . . RUN dotnet publish -c $CONF -o /app -a $TARGETARCH --no-restore FROM mcr.microsoft.com/dotnet/runtime:8.0-alpine WORKDIR /app COPY --from=build /app . USER $APP_UID ENTRYPOINT ["./WebAPI"]
Pipeline
publish-job: stage: publish when: manual image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - cp $APPSETTINGS_PRODUCTION appsettings.Production.json - /kaniko/executor --context ${CI_PROJECT_DIR}/WebAPI --dockerfile ${CI_PROJECT_DIR}/WebAPI/Dockerfile --destination ${CI_REGISTRY_IMAGE}:latest --cache=true
Attempt to change the command:
The last flag is read without a space
Solution
Wrap CICD variables in quotation marks.
RUN dotnet publish -c "$CONF" -o /app -a "$TARGETARCH" --no-restore
flag break -o in command
dotnet publish -c $CONF -a $TARGETARCH --output /app
Dockerfile
Pipeline