Deployment stuck on "Starting Container"

samoranxTRIAL

6 months ago

When I deploy my api via dockerfile , my api does not start up.

Error: "Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/7e00edc8-ef30-4b1c-a99c-7db2fb3e8c44/vol_1knuv2mlbl0g9rhc

Oct 18 17:09:30

Starting Container"

docker file is below

# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

# This stage is used when running from VS in fast mode (Default for Debug configuration)

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base

WORKDIR /app

EXPOSE 8080

EXPOSE 4433

# This stage is used to build the service project

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build

ARG BUILD_CONFIGURATION=Release

WORKDIR /src

COPY ["xxxxxxxxx.Api/xxxxxxxxx.Api.csproj", "xxxxxxxxx.Api/"]

COPY ["xxxxxxxxx.Application/xxxxxxxxx.Application.csproj", "xxxxxxxxx.Application/"]

COPY ["xxxxxxxxx.Domain/xxxxxxxxx.Domain.csproj", "xxxxxxxxx.Domain/"]

COPY ["xxxxxxxxx.WhatsAppBusiness.CloudApi/xxxxxxxxx.WhatsAppBusiness.CloudApi.csproj", "xxxxxxxxx.WhatsAppBusiness.CloudApi/"]

COPY ["xxxxxxxxx.Infrastructure/xxxxxxxxx.Infrastructure.csproj", "xxxxxxxxx.Infrastructure/"]

RUN dotnet restore "./xxxxxxxxx.Api/xxxxxxxxx.Api.csproj"

COPY . .

WORKDIR "/src/xxxxxxxxx.Api"

RUN dotnet build "./xxxxxxxxx.Api.csproj" -c Release -p:WarningLevel=0 --no-restore

# This stage is used to publish the service project to be copied to the final stage

FROM build AS publish

ARG BUILD_CONFIGURATION=Release

RUN dotnet publish "./xxxxxxxxx.Api.csproj" -c Release -p:WarningLevel=0 -o /app/publish --no-restore /p:UseAppHost=false

# Generate HTTPS certificate (without trust)

RUN dotnet dev-certs https --clean

RUN mkdir -p /app/publish/https

RUN dotnet dev-certs https --export-path /app/publish/https/aspnetapp.pfx --password njomane

# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)

FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

# Copy the generated certificate into the final image

COPY --from=publish /app/publish/https/aspnetapp.pfx .dotnet/https/aspnetapp.pfx

ENV ASPNETCORE_Kestrel__Certificates__Default__Path=.dotnet/https/aspnetapp.pfx

ENV ASPNETCORE_Kestrel__Certificates__Default__Password=password

ENTRYPOINT ["dotnet", "xxxxxxxxx.Api.dll"]

Can you please assist?

0 Replies