Project Tye not using pre-configured Dockerfile

26 views Asked by At

I have a .NET 7.0 Web API that I want to run within Docker. I created a WeatherForecast sample Web API using the dotnet templates and enabled it to support Docker in Linux mode.

My goal is to run Google Chrome inside the container so that this API can generate PDFs.

I need to get a few packages in order to run Chrome inside of a container that uses Puppeteer Sharp, as per this comment.

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

RUN apt-get update && apt-get install -y libx11-6 libx11-xcb1 libatk1.0-0 libgtk-3-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 libxshmfence1 libnss3

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["TyeDockerfile/TyeDockerfile.csproj", "TyeDockerfile/"]
RUN dotnet restore "TyeDockerfile/TyeDockerfile.csproj"
COPY . .
WORKDIR "/src/TyeDockerfile"
RUN dotnet build "TyeDockerfile.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "TyeDockerfile.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "TyeDockerfile.dll"]

I want to use Project Tye in Docker mode to use this Dockerfile as opposed to generating its own. According to various GitHub comments, this is possible out of the box but I am not able to get it to use my Dockerfile and instead it continues to generate its own.

The command I am using is:

tye run --dashboard --docker

Any help appreciated.

I have reset docker fully by removing all containers, images and volumes, but it still ignores it. I have also created a tye.yaml in the root of the project but still it ignores it.

name: TyeDockerfile
services:
- name: TyeDockerfile-API
  project: TyeDockerfile.csproj
  env:
  - name: ASPNETCORE_ENVIRONMENT
    value: Development
  bindings:
   - name: http
     port: 55706
0

There are 0 answers