8 months ago
✕ [stage-0 8/10] RUN flask db stamp head && flask db upgrade
process "/bin/bash -ol pipefail -c flask db stamp head && flask db upgrade" did not complete successfully: exit code: 1
May 29 09:51:35
Dockerfile:24
May 29 09:51:35
-------------------
May 29 09:51:35
22 | # release phase
May 29 09:51:35
23 | COPY . /app/.
May 29 09:51:35
24 | >>> RUN flask db stamp head && flask db upgrade
May 29 09:51:35
25 |
May 29 09:51:35
26 |
May 29 09:51:35
-------------------
May 29 09:51:35
ERROR: failed to solve: process "/bin/bash -ol pipefail -c flask db stamp head && flask db upgrade" did not complete successfully: exit code: 1
May 29 09:51:35
Error: Docker build failed
2 Replies
8 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 9 months ago
8 months ago
Probably because you are trying to run flask db upgrade during the Docker build, but at that time the app can't connect to your database since it's not running or the env vars aren't set yet.
What you wanna do is move the migration commands out of the build step and run them when the container actually starts, like in the shell or entrypoint script. That way the DB is up and env vars are there.
So, remove RUN flask db stamp head && flask db upgrade from your Dockerfile, and instead run flask db upgrade just before starting your app.
Also, double check you have DATABASE_URL set properly in Railway's env variables. Without that, Flask can't find the DB.
In case it doesn't fix the problem, please share your Dockerfile so I can help further.
4 months ago
You can add this command to run as a custom start command. That is found by navigating to the project > Settings > Deploy and it is the first option.