-
Hi 👋🏻 I'm trying to build this FROM --platform=$TARGETARCH mu88/screenshotcreator-playwright:latest AS base
ARG TARGETARCH
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG TARGETARCH
WORKDIR /src
COPY . .
RUN dotnet publish -a $TARGETARCH "/src/src/ScreenshotCreator.Api/ScreenshotCreator.Api.csproj" -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=build /app/publish .
RUN chmod +x /app/.playwright/node/*/node
ENTRYPOINT ["dotnet", "ScreenshotCreator.Api.dll"] Here's what I try to do (following the docs): var futureImage = new ImageFromDockerfileBuilder()
.WithDockerfileDirectory(CommonDirectoryPath.GetSolutionDirectory(), Path.Combine("src", "ScreenshotCreator.Api"))
.WithDockerfile("Dockerfile")
.Build();
await futureImage.CreateAsync(); This fails with the following error: System.InvalidOperationException : Docker image localhost/testcontainers/b0f62461-c8a3-4ec4-9bc0-dfdbbcf10e4c:latest has not been created.
at DotNet.Testcontainers.Clients.DockerImageOperations.BuildAsync(IImageFromDockerfileConfiguration configuration, ITarArchive dockerfileArchive, CancellationToken ct)
at DotNet.Testcontainers.Clients.TestcontainersClient.BuildAsync(IImageFromDockerfileConfiguration configuration, CancellationToken ct)
at DotNet.Testcontainers.Images.FutureDockerImage.UnsafeCreateAsync(CancellationToken ct)
at DotNet.Testcontainers.Images.FutureDockerImage.CreateAsync(CancellationToken ct)
at Tests.Integration.Api.ProgramTests.CreateImageNowForOpenHab2() in C:\Users\MyUser\Documents\Development\GitHub\ScreenshotCreator\tests\Tests\Integration\Api\ProgramTests.cs:line 59
at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](Func`1 invoke)
at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()
at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
-----
One or more child tests had errors
Exception doesn't have a stacktrace
info: ScreenshotCreator.Api.BackgroundScreenshotCreator[1]
Background service disabled
[testcontainers.org 00:00:00.17] Connected to Docker:
Host: npipe://./pipe/docker_engine
Server Version: 24.0.7
Kernel Version: 5.15.123.1-microsoft-standard-WSL2
API Version: 1.43
Operating System: Docker Desktop
Total Memory: 7.64 GB
[testcontainers.org 00:00:00.31] Pattern ^(.+)\/\.idea added to the regex cache
[testcontainers.org 00:00:00.31] Pattern ^([\\\/]?(\.idea\b|$)) added to the regex cache
[testcontainers.org 00:00:00.31] Pattern ^([\\\/]?((.+)\/\.vs\b|$)) added to the regex cache
[testcontainers.org 00:00:00.31] Pattern ^([\\\/]?(\.vs\b|$)) added to the regex cache
[testcontainers.org 00:00:00.31] Pattern ^([\\\/]?(\.dockerignore\b|$)) added to the regex cache
[testcontainers.org 00:00:00.31] Pattern ^([\\\/]?(Dockerfile\b|$)) added to the regex cache
[testcontainers.org 00:02:22.47] failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument I already found #993, but I don't (yet) see how I have to modify my test to get rid of the error, PS: The Docker image |
Beta Was this translation helpful? Give feedback.
Answered by
mu88
Feb 9, 2024
Replies: 1 comment 9 replies
-
Did you set the build arg
Can you try to enable the debug log messages? I guess the dotnet build fails.
|
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I can confirm that the following code successfully builds the Docker image on my laptop: