Добавьте частный источник nuget в сборку Docker с секретами GitHub.C#

Место общения программистов C#
Ответить Пред. темаСлед. тема
Гость
 Добавьте частный источник nuget в сборку Docker с секретами GitHub.

Сообщение Гость »


I am currently getting a 401 unauthorised when trying to add the NuGet packet source to my docker build.

I started by adding the NuGet source URL into the docker file with:

RUN dotnet nuget add source https://nuget.pkg.github.com/blah/index.json -UserName "AZ" -Password $NUGET_AUTH_TOKEN The logs show that it getting the URL correct but 401 as it's not looking like it's using the var "NUGET_AUTH_TOKEN".

The NuGet auth token NUGET_AUTH_TOKEN is a GitHub secret which I'm passing as a env and using when setting up dotnet

In my GitHub Workflow I am then passing these value in by using "--build-arg"

--build-arg NUGET_URL=${{ env.NUGET_URL }} --build-arg NUGET_AUTH_TOKEN=${{ secrets.NUGET_TOKEN }} GitHub Workflow:

- name: Build and Push Docker image id: build-image working-directory: ./src/Blah env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} IMAGE_TAG: ${{ github.sha }} run: | docker build --build-arg NUGET_URL=${{ env.NUGET_URL }} --build-arg NUGET_AUTH_TOKEN=${{ secrets.NUGET_TOKEN }} -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Blah.Blah/Dockerfile . Dockerfile

RUN dotnet nuget add source https://nuget.pkg.github.com/blah/index.json -UserName "AZ" -Password $NUGET_AUTH_TOKEN RUN dotnet restore "Blah.Blah/Blah.Blah.csproj" COPY . . WORKDIR "/src/Blah.Blah" RUN dotnet build "Blah.Blah.csproj" -c Release -o /app/build Currently blocked and this has been the first time I've used private NuGet packages with Docker containers. Any help would be highly appreciated.


Источник: https://stackoverflow.com/questions/781 ... ub-secrets
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «C#»