I'm using .NET Core 3.1. using drone to do C/D.
My .drone.yml is
kind: pipeline
type: docker
name: deployment
steps:
- name: build
image: registry.cn-hangzhou.aliyuncs.com/yoyosoft/dotnet/core/sdk
commands:
- dotnet restore src/YOGA.Api
- dotnet restore src/YOGA.MIniProgram.API
- dotnet publish src/YOGA.Api --framework netcoreapp3.1 --configuration Release --output src/YOGA.Api/dist
- dotnet publish src/YOGA.MIniProgram.API --framework netcoreapp3.1 --configuration Release --output src/YOGA.MIniProgram.API/dist
- echo "$(pwd)"
- ls
- cd src
- ls
- cd YOGA.Api
- ls
- name: YOGA.Api to AliyunHub
image: plugins/docker
settings:
dockerfile: src/YOGA.Api/Dockerfile
tags: latest
insecure: true
registry: "registry.cn-qingdao.aliyuncs.com"
repo: "registry.cn-qingdao.aliyuncs.com/yoga_images/mrt_backend_api/mrt_backend_api"
username:
from_secret: username
password:
from_secret: userpassword
- name: YOGA.Mini to AliyunHub
image: plugins/docker
settings:
dockerfile: src/YOGA.MIniProgram.API/Dockerfile
tags: latest
insecure: true
registry: "registry.cn-qingdao.aliyuncs.com"
repo: "registry.cn-qingdao.aliyuncs.com/yoga_images/mini_mrt_backend_api"
username:
from_secret: username
password:
from_secret: userpassword
- name: deploy
image: appleboy/drone-ssh
pull: true
settings:
host: ...
port: ...
username: ...
password: ...
script:
- echo start deploy- echo pulling images from AliyunHub
- docker login --username=...registry.cn-qingdao.aliyuncs.com --password=...
- docker pull docker pull registry.cn-qingdao.aliyuncs.com/yoga_images/mini_mrt_backend_api:latest
- docker tag registry.cn-qingdao.aliyuncs.com/yoga_images/mini_mrt_backend_api:latest mini-mrt-api:latest
- docker run --name mrt-mini-api -d -p xxx:80 mini-mrt-api
- docker pull registry.cn-qingdao.aliyuncs.com/yoga_images/mrt_backend_api:latest
- docker tag registry.cn-qingdao.aliyuncs.com/yoga_images/mrt_backend_api:latest mrt-api:latest
- docker run --name mrt-api -d -p xxx:5000 mrt-api
Drone works fine.
Here is my dockerfile which looks similar...
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
RUN echo "PWD is: $PWD"
COPY src/YOGA.Api/dist /app
WORKDIR /app
EXPOSE 5000
ENTRYPOINT ["dotnet","YOGA.Api.dll"]
Here's the output from the the ls command
enter image description here
Everything looks fine.
After drone finishes, the container does not start up,
Here's the error from the docker logs...
docker logs 57c728d627cd
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
Anyone know the solution?
thx a lot
it works
i'm pushing to my repository has failed.
Related
I have a C# asp.net mvc app. I launch it via docker and it works perfectly. It even works over https. On the initial run, I have to run these commands:
dotnet dev-certs https --clean
dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p <MY PASSWORD>
dotnet dev-certs https --trust
Then I launch the app via docker-compose --env-file .env up. The docker-compose file looks like this:
version: '3.8'
volumes:
data:
services:
postgresql_MENTIONvlt_bg:
image: postgres
# explicit container name
container_name: postgresql_vlt_bg
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
ports:
- 5432:5432
volumes:
- data:/var/lib/postgresql_vlt_bg
amaranth_main:
container_name: amaranth_main
links:
- postgresql_MENTIONvlt_bg
depends_on:
- postgresql_MENTIONvlt_bg
build:
context: .
dockerfile: Dockerfile
ports:
- 8000:5000
- 8001:5001
environment:
- ASPNETCORE_ENVIRONMENT=Release
- ASPNETCORE_Kestrel__Certificates__Default__Password=${Kestrel_Cert_Password}
- ASPNETCORE_Kestrel__Certificates__Default__Path=${Kestrel_Cert_Rel_Path}
- ApiEndpoints__MainNet__2=${API_KEY_BLOCKCHAIN}
- ApiEndpoints__TestNet__2=${API_KEY_BLOCKCHAIN}
- ConnectionStrings__db=${CONNECTION_STRING_DB}
- ApiEndpoints__EmailUsername=${EMAIL_USERNAME}
- ApiEndpoints__EmailPassword=${EMAIL_PASSWORD}
- ApiEndpoints__SmtpDomain=${SMPT_DOMAIN}
- ApiEndpoints__SmtpPort=${SMPT_PORT}
- ApiEndpoints__SmtpPostmarkKey=${SMPT_POSTMARK_KEY}
volumes:
- ${Kestrel_Cert_Abs_Path}:/https:ro
My ${Kestrel_Cert_Abs_Path} is set to ~/.aspnet/https and my ${Kestrel_Cert_Rel_Path} is set to /https/aspnetapp.pfx
The problem is that a fellow developer with whom I am working didn't want to run the dotnet dev-certs https commands because he didn't want to mess with his local host computer's dev-certs. Is there any way to launch an asp.net mvc app over https without needing to run the dotnet dev-certs https commands?
You can create your certificates in "amaranth_main" container
Something like:
docker-compose exec amaranth_main sh -c "dotnet dev-certs https --clean"
docker-compose exec amaranth_main sh -c "dotnet dev-certs https -ep /https/aspnetapp.pfx -p <MY PASSWORD>"
docker-compose exec amaranth_main sh -c "dotnet dev-certs https --trust"
So I have a .NET solution with two projects. These work fine when running with dotnet run, but I'm having issues with my docker compose. When adding env variables with url paths to talk between containers, i generally use something like host.docker.internal to resolve the path to the other container, but for some reason that doesn't resolve and just gets used as, for instance, https://host.docker.internal:49833/connect/authorize instead of https://localhost:49833/connect/authorize.
This doesn't make sense to me as i literally have another project on my machine that runs with this setup just fine. what am i missing?
project 1 has a dockerfile like this:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY ["RecipeManagement/src/RecipeManagement/RecipeManagement.csproj", "./RecipeManagement/src/RecipeManagement/"]
#COPY ["SharedKernel/SharedKernel.csproj", "./SharedKernel/"]
RUN dotnet restore "./RecipeManagement/src/RecipeManagement/RecipeManagement.csproj"
# Copy everything else and build
COPY . ./
RUN dotnet build "RecipeManagement/src/RecipeManagement/RecipeManagement.csproj" -c Release -o /app/build
FROM build-env AS publish
RUN dotnet publish "RecipeManagement/src/RecipeManagement/RecipeManagement.csproj" -c Release -o /app/out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=publish /app/out .
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
ENTRYPOINT ["dotnet", "/app/RecipeManagement.dll"]
project 2 has a dockerfile like this:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
RUN apt install -y nodejs
# Copy csproj and restore as distinct layers
COPY ["AuthServerWithDomain/AuthServerWithDomain.csproj", "./AuthServerWithDomain/"]
#COPY ["SharedKernel/SharedKernel.csproj", "./SharedKernel/"]
RUN dotnet restore "./AuthServerWithDomain/AuthServerWithDomain.csproj"
# Copy everything else and build
COPY . ./
RUN dotnet build "AuthServerWithDomain/AuthServerWithDomain.csproj" -c Release -o /app/build
FROM build-env AS publish
RUN dotnet publish "AuthServerWithDomain/AuthServerWithDomain.csproj" -c Release -o /app/out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=publish /app/out .
ENV ASPNETCORE_URLS=http://+:8080
EXPOSE 8080
ENTRYPOINT ["dotnet", "/app/AuthServerWithDomain.dll"]
and the compose looks like this:
version: '3.7'
services:
recipemanagement-db:
image: postgres
restart: always
ports:
- '63230:5432'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dev_recipemanagement
volumes:
- recipemanagement-data:/var/lib/postgresql/data
recipemanagement-api:
build:
context: .
dockerfile: RecipeManagement/src/RecipeManagement/Dockerfile
ports:
- "63231:8080"
environment:
ASPNETCORE_ENVIRONMENT: "Development"
ASPNETCORE_URLS: https://+:8080;
ASPNETCORE_Kestrel__Certificates__Default__Path: "/https/aspnetappcert.pfx"
ASPNETCORE_Kestrel__Certificates__Default__Password: "password"
DB_CONNECTION_STRING: "Host=recipemanagement-db;Port=5432;Database=dev_recipemanagement;Username=postgres;Password=postgres"
"AUTH_AUDIENCE": "recipe_management"
"AUTH_AUTHORITY": "https://host.docker.internal:49833"
# ^^^^^^^^^^^ not sure why this and the below don't resolve *************************************************************************
"AUTH_AUTHORIZATION_URL": "https://host.docker.internal:49833/connect/authorize"
"AUTH_TOKEN_URL": "https://host.docker.internal:49833/connect/token"
"AUTH_CLIENT_ID": "recipe_management.swagger"
"AUTH_CLIENT_SECRET": "974d6f71-d41b-4601-9a7a-a33081f80687"
"RMQ_HOST": "localhost:TBDRMQPORT"
"RMQ_VIRTUAL_HOST": "/"
"RMQ_USERNAME": "guest"
"RMQ_PASSWORD": "guest"
volumes:
- ~/.aspnet/https:/https:ro
recipemanagement-authserver:
build:
context: .
dockerfile: AuthServerWithDomain/Dockerfile
ports:
- "49833:8080"
environment:
"ASPNETCORE_ENVIRONMENT": "Development"
ASPNETCORE_URLS: "https://+:8080;"
ASPNETCORE_Kestrel__Certificates__Default__Path: "/https/aspnetappcert.pfx"
ASPNETCORE_Kestrel__Certificates__Default__Password: "password"
volumes:
- ~/.aspnet/https:/https:ro
volumes:
recipemanagement-data:
See #DavidMaze comment. Best to search on Networking in Compose as the starting point.
(The Dockerfile's should be irrelevant to your question.)
There are a couple of options, with trial and error to get the exact behavior you want. I'd encourage you to find better explanations on the following suggestions:
In your compose file, at the 'service' level, you can add extra_hosts
my-service:
extra_hosts:
host.docker.internal:host-gateway
#host.docker.internal:127.0.0.1 for linux
But when using compose, a better option is to have docker create a network specific to your containers with
docker network create --driver bridge my_recipe_ntwk
and then at the top level of your compose:
services:
volumes:
networks:
my-private-ntwk:
external:
name: my_recipe_ntwk
and then at the 'service' level
my-service-1:
networks:
- my-private-ntwk
my-service-2:
networks:
- my-private-ntwk
For postgres running on the host, see this answer and there should be a few other similar answers.
I believe if all services are configured on the same bridge network, you actually use the service name, e.g. my-service-1:8080 and don't inclue the https. I might be wrong. (In my case, my containers connect to Postgres on the host itself, and that requries 'extra_hosts' and it's own special workaround.) You are hosting a Postgres container, so I believe your connection host and port, when using the bridge network, would simply be my-private-ntwk:5432
I am using github to host private nuget packages, and the project I am trying to build an image for uses one of those packages. When image is being built via a github action I successfully add the nuget source, but restore fails to find it. However if I run it locally everything works just fine.
Action yaml:
name: Docker
on:
release:
branches: [ master, qa ]
tags: [ 'v*.*.*' ]
types: [ published ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ph/logging-api #<------------------------Container name
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout#v2
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action#79abd3f86f79a9d68a23c75a09a9a85889262adf
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action#28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action#98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action#ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
file: api.Dockerfile #<----------------------------------------- Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
REGISTRY_USER=${{ github.actor }}
REGISTRY_TOKEN=${{ secrets.GITHUB_TOKEN }}
Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal AS base
WORKDIR /app
EXPOSE 5000
ENV ASPNETCORE_URLS=http://+:5000
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to https://aka.ms/vscode-docker-dotnet-configure-containers
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
WORKDIR /src
ARG REGISTRY_USER
ARG REGISTRY_TOKEN
RUN dotnet nuget add source --username $REGISTRY_USER --password $REGISTRY_TOKEN --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ph/index.json"
COPY ["ph.LogApi/ph.LogApi.csproj", "ph.LogApi/"]
RUN dotnet restore "ph.LogApi/ph.LogApi.csproj"
COPY . .
WORKDIR "/src/ph.LogApi"
RUN dotnet build "ph.LogApi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "ph.LogApi.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ph.LogApi.dll"]
If I execute the docker file directly and pass in the build-args it works great. However in the github action it successfully adds the nuget source and then fails to find the package in either of them.
#10 [build 3/8] RUN dotnet nuget add source --username h-w -*** --store-password-in-clear-text --name github "https://nuget.pkg.github.com/ph/index.json"
#10 0.305 Package source with Name: github added successfully.
#10 DONE 0.3s
#11 [build 4/8] COPY [ph.LogApi/ph.LogApi.csproj, ph.LogApi/]
#11 DONE 0.0s
#12 [build 5/8] RUN dotnet restore "ph.LogApi/ph.LogApi.csproj"
#12 0.792 Determining projects to restore...
#12 4.158 /src/ph.LogApi/ph.LogApi.csproj : error NU1101: Unable to find package ph.Configuration. No packages exist with this id in source(s): github, nuget.org
#12 4.343 Failed to restore /src/ph.LogApi/ph.LogApi.csproj (in 3.35 sec).
#12 ERROR: process "/bin/sh -c dotnet restore \"ph.LogApi/ph.LogApi.csproj\"" did not complete successfully: exit code: 1
------
> [build 5/8] RUN dotnet restore "ph.LogApi/ph.LogApi.csproj":
#12 0.792 Determining projects to restore...
#12 4.158 /src/ph.LogApi/ph.LogApi.csproj : error NU1101: Unable to find package ph.Configuration. No packages exist with this id in source(s): github, nuget.org
#12 4.343 Failed to restore /src/ph.LogApi/ph.LogApi.csproj (in 3.35 sec).
------
api.Dockerfile:18
--------------------
16 | RUN dotnet nuget add source --username $REGISTRY_USER -*** --store-password-in-clear-text --name github "https://nuget.pkg.github.com/PhoeniqsTech/index.json"
17 | COPY ["ph.LogApi/ph.LogApi.csproj", "ph.LogApi/"]
18 | >>> RUN dotnet restore "ph.LogApi/ph.LogApi.csproj"
19 | COPY . .
20 | WORKDIR "/src/ph.LogApi"
--------------------
error: failed to solve: process "/bin/sh -c dotnet restore \"ph.LogApi/ph.LogApi.csproj\"" did not complete successfully: exit code: 1
Error: buildx call failed with: error: failed to solve: process "/bin/sh -c dotnet restore \"ph.LogApi/ph.LogApi.csproj\"" did not complete successfully: exit code: 1
Any input as to what the problem could be is greatly appreciated!
I`m trying to incorporate the azure function (c#) in the already existing docker-compose file. By reverse engineering from how visual studio starting container and build image, I have ended up with something like this:
version: '3.4'
services:
azure.storage.emulator:
image: "mcr.microsoft.com/azure-storage/azurite:latest"
container_name: azure.storage.emulator
ports:
- 10000:10000
- 10001:10001
volumes:
- azurite_data:/data mcr.microsoft.com/azure-storage/azurite
networks:
- internal_network
azure.function:
build:
context: .
dockerfile: FunctionApp/Dockerfile
volumes:
- 'C:\Users\MyComputer\vsdbg\vs2017u5:/remote_debugger:rw'
- 'C:\Users\MyComputer\Desktop\docker infrastructure\TestFunction\FunctionApp\FunctionApp:/home/site/wwwroot'
- 'C:\Users\MyComputer\Desktop\docker infrastructure\TestFunction\FunctionApp:/src/'
- 'C:\Users\MyComputer\AppData\Local\AzureFunctionsTools\Containers_2109029\Releases\3.20.0\linuxCLI:/functions_debugging_cli:ro'
- 'C:\Users\MyComputer\.nuget\packages\:/root/.nuget/fallbackpackages2'
- 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder:/root/.nuget/fallbackpackages'
ports:
- 8081:80
container_name: Azure.Function
networks:
- internal_network
entrypoint:
- tail
command:
- -f
- /dev/null
depends_on:
- azure.storage.emulator
environment:
- DOTNET_USE_POLLING_FILE_WATCHER=1
- ASPNETCORE_ENVIRONMENT=Development
- ASPNETCORE_URLS=http://*:10123
- NUGET_PACKAGES=/root/.nuget/fallbackpackages2
- NUGET_FALLBACK_PACKAGES=/root/.nuget/fallbackpackages;/root/.nuget/fallbackpackages2
- WEBSITE_MAX_DYNAMIC_APPLICATION_SCALE_OUT=1,
- FUNCTIONS_WORKER_RUNTIME=dotnet
- AzureWebJobsStorage=DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://azure.storage.emulator:10000/devstoreaccount1;QueueEndpoint=http://azure.storage.emulator:10001/devstoreaccount1;
# NETWORKS
networks:
internal_network:
# VOLUMES
volumes:
azurite_data:
Hitting localhost/8081 I can verify that function is running, but I can not confirm that it does its job.
Another big problem is that when I attach to function with a remote debugger I can not debug it, because symbols are not loaded.
I would really appreciate it if anybody can help me with running and debugging the Azure function started through a docker-compose file.
There are several articles on the web, but I haven't had luck with the steps described in them.
my docker file looks like this:
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice AS base
WORKDIR /home/site/wwwroot
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["FunctionApp/FunctionApp.csproj", "FunctionApp/"]
RUN dotnet restore "FunctionApp/FunctionApp.csproj"
COPY . .
WORKDIR "/src/FunctionApp"
RUN dotnet build "FunctionApp.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "FunctionApp.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /home/site/wwwroot
COPY --from=publish /app/publish .
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
To summarize, I`m asking for help with starting and debugging azure functions v3 started by docker-compose
I have ended up with a custom image. It works fine in the local environment and debugger can be attached to it, but I`m not sure if suitable to deploy image to azure, probably not.
Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
RUN apt-get update
RUN apt-get -y install curl gnupg
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN apt-get -y install nodejs
RUN npm i -g azure-functions-core-tools#3 --unsafe-perm true
RUN apt-get install -y unzip
RUN curl -sSL https://aka.ms/getvsdbgsh | /bin/sh /dev/stdin -v latest -l ~/vsdbg
WORKDIR /src
COPY ["FunctionApp/FunctionApp.csproj", "FunctionApp/"]
RUN dotnet restore "FunctionApp/FunctionApp.csproj"
COPY . .
WORKDIR "/src/FunctionApp"
ENTRYPOINT ["func","host","start","--verbose"]
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
In this case, I believe you'll have to do the profiling. You will have to follow these:
If its not a blessed image, then first you would have to install SSH if you want to get into the container.
Then you will have to make use of tools such as cProfile or other related python modules to profile the code.
Here is a documentation for windows application. You might want to take a look : https://azureossd.github.io/2017/09/01/profile-python-applications-in-azure-app-services/index.html
This issue has been tracked : https://github.com/Azure/azure-functions-docker/issues/17
How can I restore nuget packages hosted in GitHub packages within a Dockerfile?
When I create a NuGet.config file, I need to set a token there (only a readonly token) to access GitHub Packages, even on public repositories :-( . This password will be deleted by GitHub immediately. Is there another way?
Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["Deploy_O_Mat.API/Deploy_O_Mat.API.csproj", "Deploy_O_Mat.API/"]
COPY ["NuGet.config", "Deploy_O_Mat.API/"]
RUN dotnet restore "Deploy_O_Mat.API/Deploy_O_Mat.API.csproj"
COPY . .
WORKDIR "/src/Deploy_O_Mat.API"
RUN dotnet build "Deploy_O_Mat.API.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Deploy_O_Mat.API.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Deploy_O_Mat.API.dll"]
Action (build - restore works without NuGet.config file):
name: .NET Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v2
- name: Setup .NET Core
uses: actions/setup-dotnet#v1
with:
dotnet-version: 3.1.100
source-url: https://nuget.pkg.github.com/Marcel-B/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
Action (Docker image build and deply without NuGet.config - doesn't work):
name: Publish Docker
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#master
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action#master
with:
name: millegalb/deploy-o-mat
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
source-url: https://nuget.pkg.github.com/Marcel-B/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}