Skip to content

Copy and Add don't work as expected. #284

@Marvin-Brouwer

Description

@Marvin-Brouwer

I'm trying to build my own image, and I want to copy some files onto it.
When I use an absolute path, the COPY and ADD commands break.
When I try to generate the path and set copy the files there first, the ${RND} part of the template don't match.

I'm currently trying this:

		var tempDir = (TemplateString)@"${TEMP}/fluentdockertest/${RND}";
		Directory.CreateDirectory(tempDir);
		var initScriptPath = (TemplateString)@$"{tempDir}/{InitScriptName}";
		CopyInitScript(initScriptPath, dbCreateScripts);

		var imageName = $"{container.FriendlyApplicationName}/{options.Name}";
		container
			.Builder
			.DefineImage(imageName).ReuseIfAlreadyExists()
			.From("mcr.microsoft.com/mssql/server:2022-latest", "base")
			.UseWorkDir("/")
			.Add(InitScriptName, $"startup/")
			.ExposePorts(1433);

The CopyInitScript is incorrectly named, it generates a script at runtime.
How do I get the correct temp folder so my dockerfile and resources can be placed next to each other?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions