Docker deploy not working
linkmadao
HOBBYOP

a year ago

When I try to deploy using this Dockerfile, I get this error, but running the same Dockerfile locally works normally.

PS: I have performed other deployments using Dockerfile on Railway and did not encounter this same error.

Solved

23 Replies

a year ago

Howdy!

By any chance are you able to share your full Dockerfile?


linkmadao
HOBBYOP

a year ago


a year ago

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER $APP_UID
WORKDIR /app

EXPOSE 8080
EXPOSE 8081

# Estágio de build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src

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

# Restaurar as dependências
RUN dotnet restore "CrowdinExtractorWebhook.Api/CrowdinExtractorWebhook.Api.csproj"

# Copiar o resto do código-fonte
COPY . .

# Build da aplicação
WORKDIR "/src/CrowdinExtractorWebhook.Api"
RUN dotnet build "CrowdinExtractorWebhook.Api.csproj" -c Release -o /app/build

# Estágio de publicação
FROM build AS publish
RUN dotnet publish "CrowdinExtractorWebhook.Api.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app

# Copiar os arquivos publicados
COPY --from=publish /app/publish .

ENV ASPNETCORE_URLS="http://+:8080"
ENV DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0

ENTRYPOINT ["dotnet", "CrowdinExtractorWebhook.Api.dll"]```


a year ago

The error comes down to the builder not being able to find CrowdinExtractorWebhook.Api/CrowdinExtractorWebhook.Api.csproj


a year ago

Can you make sure that path is right?


linkmadao
HOBBYOP

a year ago

The second image I sent when opening this thread shows that the build runs, so I'm almost certain.


linkmadao
HOBBYOP

a year ago

if the path was not correct, neither would the local image be working


linkmadao
HOBBYOP

a year ago

But the instruction may be different in railways in some way.


a year ago

I used your same Dockerfile on this simple repo,

https://github.com/crisog/railway-deploy/tree/dotnet

And it got deployed correctly here,

https://dotnet-production-005d.up.railway.app/weatherforecast

Can you show us your Click the service -> Settings -> Source?

For the sample repo, I have it default / (see image attached)

Maybe you have something different there, if not, maybe it needs to be different depending on where your Dockerfile is located in your repository.

1422757450758754438


a year ago

If you are on Mac/Linux, run this in your project directory. That'd be very helpful to see if we can figure this out <:salute:1137099685417451530>

find . -name "Dockerfile" -o -name "CrowdinExtractorWebhook.Api" -type d | head -20

linkmadao
HOBBYOP

a year ago

1422769394538381352


linkmadao
HOBBYOP

a year ago

It used to be like this

1422769653813608539


a year ago

Could you run this command in your repository root?


linkmadao
HOBBYOP

a year ago

I am using Windows, not Linux, but the folder reading structure is the same as I use in other projects and should not vary in this one.

1423133239903518872


linkmadao
HOBBYOP

a year ago

This is the tree of essential files used:

E:.

│ CrowdinExtractorWebhook.sln

│ Dockerfile

└───CrowdinExtractorWebhook.Api

│ CrowdinExtractorWebhook.Api.csproj


linkmadao
HOBBYOP

a year ago

I identified the error: For some reason, when the project was executed on the railway, it changed the name from Api to API, and since Linux is case sensitive, it gave the error.


linkmadao
HOBBYOP

a year ago

You can set it as completed.


a year ago

Interesting 🧐


linkmadao
HOBBYOP

a year ago


linkmadao
HOBBYOP

a year ago

thks for the help


a year ago

Glad you got this to work!


a year ago

Happy days. Glad all is well! Feel free to reach out again if you need anything.


a year ago

!s


Status changed to Solved noahd 11 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...