Docker deploy not working
linkmadao
HOBBYOP

8 months 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

8 months ago

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


linkmadao
HOBBYOP

8 months ago


8 months 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"]```



8 months ago

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


8 months ago

Can you make sure that path is right?


linkmadao
HOBBYOP

8 months ago

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


linkmadao
HOBBYOP

8 months ago

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


linkmadao
HOBBYOP

8 months ago

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


7 months 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


7 months 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

7 months ago

1422769394538381352


linkmadao
HOBBYOP

7 months ago

It used to be like this

1422769653813608539


7 months ago

Could you run this command in your repository root?


linkmadao
HOBBYOP

7 months 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

7 months ago

This is the tree of essential files used:

E:. │ CrowdinExtractorWebhook.sln │ Dockerfile │ └───CrowdinExtractorWebhook.Api │ CrowdinExtractorWebhook.Api.csproj


linkmadao
HOBBYOP

7 months 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

7 months ago

You can set it as completed.


7 months ago

Interesting 🧐


linkmadao
HOBBYOP

7 months ago


linkmadao
HOBBYOP

7 months ago

thks for the help


7 months ago

Glad you got this to work!


7 months ago

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


7 months ago

!s


Status changed to Solved noahd 8 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...