Can't get React + Docker production running with ENV variables
Hello!
I have a Create React app, attempting to load via Dockerfile. Works perfectly fine in dev with variables and using
npm run dev
For production, followed this common answer that didn't work
I'm wondering if it's because I had to eject the app maybe? Not sure, but here is where I am now. This is my package.json
:
This is my Dockerfile:
When I deploy in prod, I'm getting these errors:
I have the environment variables just like I have in dev. I don't understand why it can't find any of the environment variables declared the Railway. Any help?
Project ID: c7f059bc-d402-459e-afbb-0d4892a4b1a5Railway | Help Center
Getting Your Create-React-App Running on Railway – Railway | Help C...
This is a little guide to help you get your create-react-app up and running smoothly
Solution:Jump to solution
power is out so I hope I didn't misspell anything doing this on my phone.
```dockerfile
FROM node:20.9
ARG RAILWAY_ENVIRONMENT...
7 Replies
give me a list of all the environment variables your app needs please
Here's what I use:
cool, I'll get back to you when I'm on my computer!
Thank you!
Solution
power is out so I hope I didn't misspell anything doing this on my phone.
Thank you! That seemed to solve the
env
variable errors!awesome