I'm looking into using Skaffold.dev to improve my development experience with Kubernetes.
I've created a default .NET API project and it's autogenerated my docker file:
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["TestMicro/TestMicro.csproj", "TestMicro/"]
RUN dotnet restore "TestMicro/TestMicro.csproj"
COPY . .
WORKDIR "/src/TestMicro"
RUN dotnet build "TestMicro.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "TestMicro.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TestMicro.dll"]
I have created a Kubernetes manifest and all is running ok using kubectl apply
.
After installing skaffold, I ran skaffold init
and it autogenerated this
apiVersion: skaffold/v2beta8
kind: Config
metadata:
name: microservices-investigation
build:
artifacts:
- image: testmicro
context: src\Microservices\TestMicro
deploy:
kubectl:
manifests:
- k8s/TestMicro.yaml
However, when I run skaffold run
I get the following:
$ skaffold run
Generating tags...
- testmicro -> testmicro:bd61fc5-dirty
Checking cache...
- testmicro: Error checking cache.
failed to build: getting hash for artifact "testmicro": getting dependencies for "testmicro": file pattern [TestMicro/TestMicro.csproj] must match at least one file
I think this is because, when I run docker build
from the CLI, I have to run docker build -f Dockerfile ..
see why here.
I just can't figure out how to translate this into skaffold's yaml file. Any ideas?!