pre deploy commande seem's not running
mbenfriha
HOBBYOP

6 months ago

Hello, initially I had deployed with nix, but I created Dockerfile, build and deploy work, but the custom pre-deployment command does not launch (its migration with adonis), when I had used nix build, pre deploy command worked. I will need add command pre deploy in Dockerfile ?

Attachments

$10 Bounty

3 Replies

Railway
BOT

6 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!


oko-tester
HOBBY

6 months ago

Hi,
You can integrate the command directly into the container startup process so it runs before the actual application starts.
Example:

Dockerfile

FROM node:20

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

EXPOSE 3333

# Start with migration

CMD ["sh", "-c", "node ace migration:run --force && node server.js"]

With this setup, when the container starts it will first run:

node ace migration:run --force

and then start the server.

This way, you don’t need any separate pre-deploy hooks on the hosting platform.


clashing
HOBBY

6 months ago

mbenfriham, you can add the pre-deploy command on the Railway dashboard itself: https://docs.railway.com/guides/pre-deploy-command

Attachments


Loading...