Skip to content

fix: update Dockerfile to run database migrations in CMD#422

Open
kartikangiras wants to merge 2 commits intocameri:mainfrom
kartikangiras:railwayapp
Open

fix: update Dockerfile to run database migrations in CMD#422
kartikangiras wants to merge 2 commits intocameri:mainfrom
kartikangiras:railwayapp

Conversation

@kartikangiras
Copy link
Copy Markdown
Contributor

Description

Fixes the Railway deployment failure caused by running database migrations during the Docker build phase when the PostgreSQL service isn't available.

Related Issue

fixes #379

Motivation and Context

How Has This Been Tested?

docker build -f Dockerfile.railwayapp \
  --build-arg PORT=8080 \
  --build-arg PGHOST=localhost \
  --build-arg PGPORT=5432 \
  --build-arg PGDATABASE=nostream \
  --build-arg PGUSER=postgres \
  --build-arg PGPASSWORD=postgres \
  -t nostream:test .

Build completed successfully with no ECONNREFUSED errors

Screenshots (if appropriate):

Types of changes

  • Non-functional change (docs, style, minor refactor)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my code changes.
  • All new and existing tests passed.

@kartikangiras
Copy link
Copy Markdown
Contributor Author

@cameri PTAL

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Railway-focused Dockerfile to avoid running database migrations during the image build (when Postgres isn’t available), and instead run migrations when the container starts.

Changes:

  • Removed npm run db:migrate from the Docker build stage.
  • Updated the container CMD to run npm run db:migrate before starting the Node server.
  • Minor Dockerfile syntax/style normalization (AS build).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cameri
Copy link
Copy Markdown
Owner

cameri commented Apr 10, 2026

@kartikangiras could you please address the conflicts and Copilot's review?

@kartikangiras
Copy link
Copy Markdown
Contributor Author

@cameri I have made the required changes , according to the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Error: connect ECONNREFUSED ::1:5432

3 participants