-
-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does WithDockerfileDirectory()
when called will look for the directory in bin/Debug/net...
#558
Comments
WithDockerfileDirectory()
when called will look for the directory in the bin/Debug/netWithDockerfileDirectory()
when called will look for the directory in bin/Debug/net...
Thanks in advance |
Did you find a solution? Since a couple of hours, I'm trying hard to build a docker image from a relative path. With no success. |
The base path (current working directory) is the location of the executable (assembly). All kinds of configuration files are copied to the output directory (native support by MSBuild and dotnet), I think it is common. Even the access of the build output is much more straightforward.
Why is that?
Can you add a small example that you are trying to achieve? |
Yea I understand that, but it is not common to copy the dockerfile to the executable directory. Therefore I think it would be good to have this point to the root of the project by default or the folder of the class where the call is made. I would be happy to contribute to make this change? |
That would be great. Do you have anything specific in mind? I was thinking about an overloaded method, maybe something like this: public readonly struct CommonDirectoryPath
{
// TODO: Detect common directory paths
public static readonly CommonDirectoryPath GitRoot = new CommonDirectoryPath("");
public static readonly CommonDirectoryPath ProjectRoot = new CommonDirectoryPath("");
private CommonDirectoryPath(string directoryPath)
{
this.DirectoryPath = directoryPath;
}
public string DirectoryPath { get; }
}
[...]
public IImageFromDockerfileBuilder WithDockerfileDirectory(CommonDirectoryPath directoryPath, string dockerfileDirectory)
{
return this.WithDockerfileDirectory(Path.Combine(directoryPath.DirectoryPath, dockerfileDirectory));
} |
@HofmeisterAn , i've a solution with 2 projects Solution
From the IntegrationTest in TestService.Api.Tests i try to create the TestService Docker Image like
But this results in an Can you lead me into the right direction? |
It is |
Sorry, it was just wrong in my description. It is called I've pushed the Sample project into a public repo here: |
Remove line 18 in your
|
Thank you so much. This line costs me half a day. That works perfect :) |
You're welcome. Yeah, is not easy to discover. Unfortunately, the Docker remote API doesn't throw any error. We could check for mandatory files, though. |
I have not yet had a think about it, ill look into it later today. Your solution looks good though ill give it a go. Also have not had a chance to properly look at the code base yet, so going to need sometime to familarise myself with it. |
Sorry for the delay, been quite busy recently. So I have solution for this now, using the interface you suggested above. I want to test as a nuget package. How can I go creating the nuget package, its in the bin directory as I was expecting. I tried using the cake task, but getting an error: Error: Could not reach target 'Create-NuGet-Packages' since it was skipped due to a criteria. Never used cake before. |
The task is designed to run on CI/CD only. To bypass this change: testcontainers-dotnet/build.cake Line 133 in 96c7263
to |
Why does the following method
WithDockerfileDirectory()
called from theImageFromDockerfileBuilder
class look at the bin folder by default? I would of expected it to look at the relative path of the class it is being called from.Also I think the docs around the build with dockerfile is a bit lacking as it took me a while to figure out how to build the image from a docker file.
Currently using version
<PackageReference Include="Testcontainers" Version="2.1.0" />
The text was updated successfully, but these errors were encountered: