.NET Dockerfile continuously failing

jamesideHOBBY

a year ago

Hi,

I am trying to build a .net API using .net 7 on this platform. I have a working Dockerfile in my local directory that I can verify is building and working when testing. But every time I try and deploy to Railway I am greeted with the same error :

2.440 MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

This to me is confusing, as I have made sure that I am including the api.csproj and api.slmslnin source control.

I have googled and googled and stackoverflowed until giving up I could not find a solution, so I am reaching out to try and get some guidance as to what is happening. Just to reiterate - this Dockerfile is building normally on my local machine. Is there something glaringly obvious as to why I am not able to build .net from a dockerfile on this platform?

My complete dockerfile is something like this:

Build Stage

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

WORKDIR /source

COPY . .

RUN dotnet restore "src/api/api.csproj" --disable-parallel
RUN dotnet publish "src/api/api.csproj" -c Release -o /app --no-restore

Serve Stage

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

WORKDIR /app

Copy from /app directory into build directory to serve

COPY --from=build /app ./

EXPOSE 80

ENTRYPOINT ["dotnet", "api.dll"]

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

6 Replies

a year ago

Are you sure your Dockerfile is at least getting used when deploying to Railway?


jamesideHOBBY

a year ago

Yes, it fails at 6/9 steps.


a year ago

What command do you to build an image from your Dockerfile locally?


jamesideHOBBY

a year ago

Switched to fly.io and it worked like a charm on first deploy. Peace out Railway!


a year ago

Unfortunately this was not a platform issues, Railway only ever runs your code as-is.


jamesideHOBBY

a year ago

My dockerfile didn't change between deploying to Railway and Fly