In docker i need to pass 2 arguments for restore my private nuget packages
docker build -t backend-template --build-arg ARTIFACTS_PAT=My-pat --build-arg ARTIFACTS_ENDPOINT=My-endpoint .
When i pass this arguments on DockerfileBuildArguments tag in api.csproj as environment variables the build not works

This is the command that VS runs
docker build -f "C:\Users\matmahnke\Documents\repos\myproject\Dockerfile" --force-rm -t ymstemplatebackendapi:dev --target build --build-arg ARTIFACTS_PAT= --build-arg ARTIFACTS_ENDPOINT= --label "com.microsoft.created-by=visual-studio" --label "com.microsoft.visual-studio.project-name=myproject.api" "C:\Users\matmahnke\Documents\repos\myproject"
I need it to be an environment variable to add to gitignore