Skip to content
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

Containers: support specifying a prefix to the container repository #36595

Open
tmds opened this issue Nov 1, 2023 · 2 comments
Open

Containers: support specifying a prefix to the container repository #36595

tmds opened this issue Nov 1, 2023 · 2 comments
Assignees
Labels

Comments

@tmds
Copy link
Member

tmds commented Nov 1, 2023

The container tooling will derive a name for the image based on the assembly name, and that name can be overridden by setting the ContainerRepository property.

When pushing to an image registry the name needs to be prefixed to have separate namespaces for users, apps, ...

This request is to have a property separate from ContainerRepository that allows to set this prefix.

Suggested name: ContainerRepositoryBase.

Example

in the csproj:

<ContainerRepository>frontend</ContainerRepository>

Publish with ContainerRepositoryBase set:

dotnet publish /p:PublishProfile=DefaultContainer /p:ContainerRegistry=quay.io /p:ContainerRepositoryBase=tmds/webstore

This publishes quay.io/tmds/webstore/frontend.

cc @baronfel

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Nov 1, 2023
@baronfel
Copy link
Member

baronfel commented Nov 1, 2023

This is a good request, and one that some users have asked for, especially with repositories like GitHub Packages that use a username or project name as a 'namespace'.

We should do this, but consider more names for the proposed new placeholder - for example ContainerNamespace or something. ContainerRepositoryBase is the most technically correct, I just wonder about what users will look for/expect.

@jdevillard
Copy link

I'm the same requirement,

seeing that is not close I suppose it's not available right now , so for those who are interested in this , here is a tips.

You can modify your csproj with :

<Target Name="SetContainerRepositoryBase" DependsOnTargets="$(PublishContainerDependsOn)" BeforeTargets="PublishContainer">
	<PropertyGroup>
		<ContainerRepository Condition=" '$(ContainerRepositoryBase)'!='' ">$(ContainerRepositoryBase)/$(ContainerRepository)</ContainerRepository>
	</PropertyGroup>
</Target>

and use the property in the cli :

dotnet publish --os linux --arch x64 -p ContainerRepositoryBase=MyPrefix /t:PublishContainer

@MiYanni MiYanni added Feature Request type-investigation needs team triage Requires a full team discussion and removed untriaged Request triage from a team member type-investigation labels Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants