<p>I'm looking into using Skaffold.dev to improve my development experience with Kubernetes.</p>
<p>I've created a default .NET API project and it's autogenerated my docker file:</p>
<pre><code>#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 [&quot;TestMicro/TestMicro.csproj&quot;, &quot;TestMicro/&quot;]
RUN dotnet restore &quot;TestMicro/TestMicro.csproj&quot;
COPY . .
WORKDIR &quot;/src/TestMicro&quot;
RUN dotnet build &quot;TestMicro.csproj&quot; -c Release -o /app/build

FROM build AS publish
RUN dotnet publish &quot;TestMicro.csproj&quot; -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT [&quot;dotnet&quot;, &quot;TestMicro.dll&quot;]
</code></pre>
<p>I have created a Kubernetes manifest and all is running ok using <code>kubectl apply</code>.</p>
<p>After installing skaffold, I ran <code>skaffold init</code> and it autogenerated this</p>
<pre><code>apiVersion: skaffold/v2beta8
kind: Config
metadata:
  name: microservices-investigation
build:
  artifacts:
  - image: testmicro
    context: src\Microservices\TestMicro
deploy:
  kubectl:
    manifests:
    - k8s/TestMicro.yaml

</code></pre>
<p>However, when I run <code>skaffold run</code> I get the following:</p>
<pre><code>$ skaffold run
Generating tags...
 - testmicro -&gt; testmicro:bd61fc5-dirty
Checking cache...
 - testmicro: Error checking cache.
failed to build: getting hash for artifact &quot;testmicro&quot;: getting dependencies for &quot;testmicro&quot;: file pattern [TestMicro/TestMicro.csproj] must match at least one file
</code></pre>
<p>I think this is because, when I run <code>docker build</code> from the CLI, I have to run <code>docker build -f Dockerfile ..</code> <a href="https://learn.microsoft.com/en-us/visualstudio/containers/container-build?view=vs-2019#docker-build" rel="nofollow noreferrer">see why here</a>.</p>
<p>I just can't figure out how to translate this into skaffold's yaml file. Any ideas?!</p>

penguinflip
<p>In Skaffold, the artifact <code>context</code> (sometimes called the <em>workspace</em>) is the working directory when building the artifact.  For Docker-based artifacts (the default artifact type), the artifact context is the root of the Docker build context and the <code>Dockerfile</code> in the root of the artifact's context.  You can specify an alternative Dockerfile location but it must live within the artifact context.</p>
<p>Normally <code>skaffold init</code> will create a <code>skaffold.yaml</code> where the artifact context is the directory containing a <code>Dockerfile</code>.  So if I understand your situation, I think you normally run your <code>docker build -f Dockerfile ..</code> in <code>src/Microservices/TestMicro</code>. So you should be able to also run your <code>docker build</code> via:</p>
<pre><code>C:&gt; cd ...\src\Microservices
C:&gt; docker build -f TestMicro\Dockerfile .`
</code></pre>
<p>So you need to change your artifact definition to the following:</p>
<pre><code>build:
  artifacts:
  - image: testmicro
    context: src/Microservices
    docker:
      dockerfile: TestMicro/Dockerfile
</code></pre>
