help with dockerfile
I’m trying to deploy an app on Railway, and I need to create both a server and a database.
Both the server and the database need to be specific versions.
The app server should run Node: v18.12.1 (18.x.x), and the database should be MySQL: 8.0.33.
Additionally, the server needs to be Ubuntu: 22.04.
I understand that I need to do this using a Dockerfile, but I'm not quite sure how to go about it.
Could you please help me?
Thank you so much in advance!
5 Replies
Project ID:
1b4899b7-63d5-4dd9-97f5-7efd691a049b
1b4899b7-63d5-4dd9-97f5-7efd691a049b
This feels a little XY.
Do you need that specific version for ubuntu?
Anyways, you will need to have 2 services. One for the app and one for the db. For the DB, you might not need a special docker file, and can just find one that is officially supported (from docker hub stuff) and use that as your image.
For the app, you would do a similar thing to start. Pick a version you want to pin to, and then build from there.
So https://hub.docker.com/_/node/ and https://hub.docker.com/_/mysql/
And then for the node, you would do something like
But ummmm. Why are you trying to pin to such specific versions? It just feels strange.
Thanks for your response.
I need such specific versions because the project is quite old and runs with those versions of Node and MySQL. I might also need a specific version of Yarn to install the dependencies. It's a React project so old that it uses class components and also implements SSR with an Express server.
In other words, it's an Express server that renders a page made with React, so I can deploy it directly on Railway without needing another host like Vercel, for example.
My idea was exactly as you mentioned: one instance for the database and another for the SSR server.
One more question, can automatic backups of the database be configured?
Thanks in advance for the information.
Yea it can be. I would take a look at https://railway.app/template/I4zGrH. It is for psql. But the logic you would likely want is similar.
In short though, there is no "native" backup. You would store your backup in an s3 bucket. And then you can add some lifetime rules to that bucket.
This one (https://railway.app/template/U_wjYd) should be able to handle mysql. But I have not used it so idk how good it is.