Help: Deploy prebuilt Docker image via GitHub Actions without rebuild

salim255
FREEOP

10 months ago

Hi all, I’m trying to automate deployment of my Dockerized app to Railway using GitHub Actions.

Here’s what I’m doing:

  1. Build the Docker image in GitHub Actions.
  2. Push the image to Docker Hub (crawan/housori-server:latest).
  3. Deploy the service on Railway using the Railway CLI with my Project Token.

Workflow snippet:

- name: Install Railway CLI
  run: |
    curl -fsSL https://railway.app/install.sh | sh
    export PATH="$HOME/.railway/bin:$PATH"

- name: Deploy to Railway
  run: railway deploy
  env:
    RAILWAY_TOKEN: ${{ secrets.RAILWAY_PROJECT_TOKEN }}

Problem:

  • Railway shows errors in the dashboard:
    Nixpacks build failed
    No template specified
  • I do not want Railway to build anything, just pull the Docker image from Docker Hub.
  • Tried railway link, --service, --detach with Project Token, but it fails.
  • Using User API Key is interactive and not safe for CI/CD.

What I want:

  • Programmatically trigger Railway to roll out my prebuilt Docker image from Docker Hub using Project Token, without rebuilding.

Has anyone successfully done this in CI/CD? Any recommended workflow setup?

Solved

2 Replies

fuad47
HOBBY

10 months ago

i think someone will take your post serious !


timomeh
PRO

10 months ago

Hi, add a service on Railway, choose "Docker Image" and input your docker image. Do not choose "GitHub Repo".

Then on GitHub Actions, after pushing your Docker image, you can run railway redeploy -s your-service -y. This will pull and deploy the new image, without building.


Status changed to Solved timomeh 9 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...