4 months ago
O Railway está ignorando a configuração explícita do railway.json para usar Dockerfile e está usando NIXPACK automaticamente, causando falha no build.
Configuração Atual:
{
"build": {
"builder": "DOCKERFILE",
"dockerfilePath": "Dockerfile"
}
}
Problema:
Mesmo com a configuração acima, o Railway está:
1. Usando NIXPACK automaticamente (como mostrado nos logs)
2. Executando "dotnet restore" sem especificar arquivo de projeto
3. Falhando com erro: "MSBUILD : error MSB1003: Specify a project or solution file"
Logs do Erro:
╔═════════════════════ Nixpacks v1.38.0 ═════════════════════╗
║ setup │ dotnet-sdk ║
║ install │ dotnet restore ║
║ build │ dotnet publish --no-restore -c Release -o out ║
║ start │ ./out/WebApi ║
╚════════════════════════════════════════════════════════════╝
[6/9] RUN dotnet restore
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
Estrutura do Projeto:
Solution/
├── Solution.sln
└── WebApi/
├── WebApi.csproj
├── Dockerfile
└── railway.json
Solução Esperada:
O Railway deve respeitar a configuração "builder": "DOCKERFILE" e usar o Dockerfile em vez de NIXPACK.
Reprodução:
1. Configurar railway.json com "builder": "DOCKERFILE"
2. Fazer deploy
3. Railway ignora configuração e usa NIXPACK
Impacto:
- Build falha consistentemente
- Não é possível usar Dockerfile customizado
- Configuração do railway.json é ignorada
ABORDAGENS TENTADAS PARA RESOLVER:
1. ESPECIFICAÇÃO EXPLÍCITA DO ARQUIVO DE PROJETO:
- Modificado Dockerfile para usar "dotnet restore WebApi.csproj"
- Modificado Dockerfile para usar "dotnet build WebApi.csproj"
- Modificado Dockerfile para usar "dotnet publish WebApi.csproj"
- RESULTADO: Não funcionou, Railway ainda usa NIXPACK
2. CONFIGURAÇÃO NIXPACK:
- Criado nixpacks.toml com especificação explícita do projeto
- Configurado railway.json para usar NIXPACK
- RESULTADO: NIXPACK ignora configuração e usa detecção automática
3. REMOÇÃO DE ARQUIVOS NIXPACK:
- Removido nixpacks.toml para evitar detecção automática
- Atualizado .railwayignore para excluir arquivos NIXPACK
- RESULTADO: Railway ainda usa NIXPACK automaticamente
4. DOCKERFILE ROBUSTO:
- Criado Dockerfile com debug e navegação automática
- Adicionado comandos para encontrar WebApi.csproj em diferentes locais
- RESULTADO: Railway ignora Dockerfile e usa NIXPACK
5. MÚLTIPLAS CONFIGURAÇÕES:
- Tentado diferentes configurações no railway.json
- Criado Dockerfile.railway alternativo
- RESULTADO: Railway sempre usa NIXPACK independente da configuração
VERIFICAÇÕES REALIZADAS:
-
Dockerfile funciona localmente
-
Apenas um arquivo WebApi.csproj existe no projeto
-
Configuração railway.json está correta
-
Estrutura do projeto está adequada
-
Comandos dotnet especificam arquivo de projeto explicitamente
PROBLEMA ESPECÍFICO:
O Railway está detectando automaticamente que é um projeto .NET e forçando o uso do NIXPACK, ignorando completamente a configuração "builder": "DOCKERFILE" no railway.json.
Informações Adicionais:
- Projeto .NET 8.0
- Dockerfile configurado corretamente
- Funciona localmente com Docker
- Problema específico do Railway
- Todas as abordagens de solução foram tentadas sem sucesso
3 Replies
4 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
4 months ago
If the Dockerfile is not present at the root of the repo or at the path configured as "Root Directory" then you need to set a RAILWAY_DOCKERFILE_PATH variable in the service
More on this here: https://docs.railway.com/guides/dockerfiles
That's how I do it for my monorepo setup
4 months ago
You can also configure this in your railway.json file : https://docs.railway.com/reference/config-as-code#dockerfile-path
Status changed to Solved chandrika • 4 months ago