.NET
Microsoft Technologies based on the .NET software framework.
3,412 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello everyone!
I've a weird issue with docker build in combination with GitHub actions. I'm totally new with Docker files and I really, really, really appreciate some help.
When running the command on my CLI, it works perfectly fine. But when trying it on GitHub action, I'm receiving the error:
unable to prepare context: path "..." not found Error: Process completed with exit code 1.
Command:
cd services/Gateway/OcelotGateway
docker build -f Dockerfile ... -t stanpanman/ocelotgateway:1.0.0
My GitHub Actions as follows:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: docker login
env:
DOCKER_USER: '${<!-- -->{ secrets.DOCKER_USER }}'
DOCKER_PASSWORD: '${<!-- -->{ secrets.DOCKER_PASSWORD }}'
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
- name: docker build ocelotgateway
run: |
cd services/Gateway/OcelotGateway
docker build -f Dockerfile ... -t stanpanman/ocelotgateway:1.0.0
My Docker image (auto generated by VS2022 :
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["Gateway/OcelotGateway/OcelotGateway.csproj", "Gateway/OcelotGateway/"]
RUN dotnet restore "Gateway/OcelotGateway/OcelotGateway.csproj"
COPY . .
WORKDIR "/src/Gateway/OcelotGateway"
RUN dotnet build "OcelotGateway.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "OcelotGateway.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "OcelotGateway.dll"]
How my file structure looks like: