Production deployment resolves DOCKERFILE service as RAILPACK and fails at BUILD_IMAGE
mustardir
FREEOP

2 days ago

Hello Railway Support,

I’m troubleshooting a production deployment for an existing Railway service and have isolated what appears to be a deployment configuration-resolution issue.

Service

  • Project ID: "3aa0d721-51e4-4dc1-935d-1ba7274c3f57"
    • Service: "@fortress-fund/api"
    • Service ID: "91dd24e5-3412-4d5f-a70c-61c2abcc3423"
    • Environment: "production"
    • Environment ID: "7169a25d-06ee-4e90-b147-21aefdc99809"
    • Repository: "mustardir/rentable-"
    • Branch: "main"
    • Current commit: "3fa6aca39ecb515931cd07856c9d77ca22fb2266"

Expected configuration

The current Railway service configuration reports:

  • Builder: DOCKERFILE
    • Dockerfile path: "apps/api/Dockerfile"
    • Root directory: "/"
    • Build command: "pnpm --filter @fortress-fund/api build"
    • Start command: "pnpm --filter @fortress-fund/api start"
    • Healthcheck: "/api/health"
    • No staged changes

I have also explicitly re-saved the Dockerfile/build configuration and reconnected the existing service source to:

"mustardir/rentable-" → "main"

The service configuration continues to report DOCKERFILE after these operations.

Actual deployment behavior

Despite the saved configuration, Railway's deployment snapshot resolves the deployment as:

  • Builder: "RAILPACK"
    • Dockerfile path: "apps/api/Dockerfile"
    • Failure stage: "BUILD_IMAGE"
    • Error: "Failed to build an image. Please check the build logs for more details."

The latest affected deployment is:

"2445ea82-7d59-4ace-8bf5-e282f1906af4"

The previous affected deployment was:

"b92ce959-3cb1-4604-ad29-44df2d249ad8"

Both deployments use the same repository, branch, and commit and exhibit the same DOCKERFILE-vs-RAILPACK discrepancy.

Build logs

For both failed deployments, the Railway build-log API returns an empty build-log result.

For example, deployment:

"2445ea82-7d59-4ace-8bf5-e282f1906af4"

reports:

  • Status: "FAILED"
    • Build stage: "BUILD_IMAGE"
    • Builder snapshot: "RAILPACK"
    • Build logs: empty

Because no build output is exposed, there is no underlying Docker/Railpack error available for us to diagnose.

Additional verification

The repository itself passes its GitHub CI checks on the same commit "3fa6aca39ecb515931cd07856c9d77ca22fb2266", including the API build and integration-test workflow.

The repository contains:

"apps/api/Dockerfile"

and the Railway service is explicitly configured to use that Dockerfile.

We also tested a diagnostic deployment that added a Prisma-client verification step to the Dockerfile. That deployment failed at "BUILD_IMAGE" before reaching the diagnostic command, further indicating that the configured Dockerfile build is not actually being executed.

Diagnostic deployment:

"fa37d0e4-4687-4ced-973d-c3aeccdbc487"

The service was subsequently restored to "main" and the diagnostic repository change was not retained.

Request

Could you please investigate why the deployment snapshot for this service is resolving to RAILPACK when the saved service configuration explicitly reports DOCKERFILE, and why the build logs are empty for the resulting "BUILD_IMAGE" failure?

In particular, I would appreciate verification of:

  1. The builder actually selected for deployment "2445ea82-7d59-4ace-8bf5-e282f1906af4".
  2. Why the deployment snapshot differs from the service configuration.
  3. Whether there is stale deployment/source configuration associated with this service/environment.
  4. Whether the Railway deployment/build system is failing before build logs are initialized.

Please let me know if you need any additional deployment or project identifiers.

Thank you.

$10 Bounty

9 Replies

Railway
BOT

2 days ago

This thread has been opened as a bounty so the community can help solve it.

Status changed to Open Railway • 1 day ago


Set RAILWAY_DOCKERFILE_PATH=apps/api/Dockerfile in your service variables, and redeploy.


mustardir
FREEOP

a day ago

I followed your recommendation and set RAILWAY_DOCKERFILE_PATH=apps/api/Dockerfile on the @fortress-fund/api production service, then redeployed.

New deployment: a0a4646e-7744-4c8d-81d6-bc5da12ff6f2

The deployment snapshot still resolves the builder as RAILPACK, despite the service configuration being DOCKERFILE and the variable being present. It again fails at BUILD_IMAGE, with no build logs exposed.

This appears to confirm that the deployment snapshot is not honoring either the service's Dockerfile builder configuration or RAILWAY_DOCKERFILE_PATH. Could you please investigate the deployment/source configuration resolution for this service?


mustardir
FREEOP

a day ago

Thanks. I followed the RAILWAY_DOCKERFILE_PATH recommendation.

I set the following service variable on @fortress-fund/api in the production environment:

RAILWAY_DOCKERFILE_PATH=apps/api/Dockerfile

I then manually redeployed the existing service.

Result: the problem persists.

The new deployment was:

a0a4646e-7744-4c8d-81d6-bc5da12ff6f2

Railway's deployment diagnosis reports:

Status: FAILED
Builder: RAILPACK
Dockerfile: apps/api/Dockerfile
Root directory: /
Failure stage: BUILD_IMAGE
Error: Failed to build an image. Please check the build logs for more details.

The service configuration still reports the builder as DOCKERFILE, with:

Repository: mustardir/rentable-
Branch: main
Root: /
Dockerfile: apps/api/Dockerfile
Build command: pnpm --filter @fortress-fund/api build

The build-log query for the deployment returned no build log entries.

This means the suggested variable did not change the builder selected in the deployment snapshot: it still resolves to RAILPACK even though the service configuration is DOCKERFILE and RAILWAY_DOCKERFILE_PATH is set.

For comparison, the immediately preceding deployment was also affected:

2445ea82-7d59-4ace-8bf5-e282f1906af4

It likewise resolved to RAILPACK and failed at BUILD_IMAGE.

Could you please advise what Railway-side configuration or deployment state determines the builder shown in the deployment snapshot, and why it is resolving to RAILPACK despite the service configuration and RAILWAY_DOCKERFILE_PATH both specifying the Dockerfile?

I have not made any further repository changes or database changes. The application commit being deployed is still:

3fa6aca39ecb515931cd07856c9d77ca22fb2266

At this point, the remaining blocker is understanding why the deployment snapshot is not honoring the configured Dockerfile builder.


Have you applied the changes after adding the variable? It should auto redeploy when you apply changes, instead of you manually redeploying.

image.png

Attachments


hdnexus
PRO

a day ago

Three different config changes — re-saving the Dockerfile settings, reconnecting the source, adding RAILWAY_DOCKERFILE_PATH — all produced identical results. That pattern is the most informative thing in your report: when nothing you change in the dashboard has any effect, something outside the dashboard is deciding.

First thing to check: railway.json or railway.toml in the repo. Look at the repo root and apps/api/. Config-as-code overrides dashboard settings without updating what the dashboard displays — which is precisely your symptom, service config reporting DOCKERFILE while the deployment snapshot resolves otherwise. In the deployment details pane, values sourced from a config file are marked with a file icon; that tells you where each setting actually came from. If such a file exists and declares a builder, or sets build.buildCommand without build.dockerfilePath, that's the whole explanation and it accounts for all three interventions failing.

Second: clear the build command. You have a Dockerfile builder and pnpm --filter @fortress-fund/api build set as the build command. Those belong to different build paths — with a Dockerfile, your RUN layers do the building and the build-command field should be empty. A service carrying both is in a mixed state, and the presence of a Railpack-era build command is a plausible reason resolution drifts toward Railpack. Same for the start command, unless your Dockerfile has no CMD.

On the empty build logs, I'd read your evidence differently. You concluded the Dockerfile isn't being executed. I think the stronger reading is that no build is executing. If Railpack were genuinely running and failing, you'd see Railpack's own output — provider detection, install phase, something before the failure. Zero log entries across four deployments means the builder died before emitting a single line. That reframes the question from "why Railpack instead of Docker" to "why does the build process fail before initialising," and the builder shown in the snapshot may simply be the default displayed when resolution never completed. Your diagnostic Dockerfile step not running is consistent with this too — it's not evidence the Dockerfile was bypassed, it's evidence nothing ran.

Monorepo detail worth confirming: with root directory /, the Docker build context is the entire repo, so apps/api/Dockerfile must address paths from the repo root — COPY pnpm-lock.yaml ./ and COPY apps/api ./apps/api, never ../../. Your GitHub CI passing on the same commit doesn't rule this out; CI almost certainly builds with -f apps/api/Dockerfile from a different working directory, so a context mismatch would pass there and fail here. If you've been developing the Dockerfile against a local docker build apps/api, that's the same mismatch.

Order: check for the config file (one look, explains everything if present), clear the build command, redeploy. If the logs are still empty after both, it's Railway-side and the deployment IDs you've already posted are what staff need.

One question that would narrow this a lot: did this service ever deploy successfully, or is this the first deploy on it? A service that used to work and then stopped points at drift — a config file added to the repo, or a builder migration. A service that has never deployed points at the Dockerfile or the context. Your report doesn't say, and the two paths diverge completely.


mustardir
FREEOP

a day ago

The test failed again.

Exact result:

  • Deployment: 6e26364d-037c-45d1-ac59-bf49ab6b373b
  • Status: FAILED
  • Failure stage: BUILD_IMAGE
  • Snapshot still reports RAILPACK
  • Dockerfile still reports apps/api/Dockerfile
  • Root: /
  • Generic error: Failed to build an image
  • Diagnosis: none

So clearing the build command did not resolve the builder-resolution problem.

Next exact action

Do not change another Railway setting yet.

We should now check the repository itself for railway.json / railway.toml at:

  • /railway.json
  • /railway.toml
  • /apps/api/railway.json
  • /apps/api/railway.toml

That is the next diagnostic because the dashboard is still showing Dockerfile while the deployment snapshot resolves RAILPACK.


mustardir
FREEOP

a day ago

Latest test result:

I cleared the Railway service build command and redeployed. The deployment still failed:

  • Deployment: 6e26364d-037c-45d1-ac59-bf49ab6b373b
  • Commit: 3fa6aca39ecb515931cd07856c9d77ca22fb2266
  • Failure stage: BUILD_IMAGE
  • Deployment snapshot builder: RAILPACK
  • Dockerfile path: apps/api/Dockerfile
  • Root directory: /
  • Build command: empty
  • Start command: pnpm --filter @fortress-fund/api start

I also checked the repository on main. There is no railway.json or railway.toml at the repo root or under apps/api/.

So the service has no Railway config-as-code file declaring the builder, and the build command is now empty, but the deployment snapshot still resolves to RAILPACK while the service configuration reports Dockerfile.

Please investigate the builder-resolution/deployment initialization for deployment 6e26364d-037c-45d1-ac59-bf49ab6b373b and provide the exact underlying diagnostic/build logs, including why RAILPACK is being selected and why the build fails at BUILD_IMAGE.


mustardir
FREEOP

a day ago

The next thing we need from Support is why that configuration is turning into RAILPACK during deployment


12 hours ago

Can you share the screenshot of your Build Logs?


Welcome!

Sign in to your Railway account to join the conversation.

Loading...