R
Railway•16mo ago
rafael.soteldo

How to vew a FrontEnd React App deployed on Railway

I deployed a doeckerized React app, generated it's domain, connected it to an similar image on Dockerhub. But I keep getting 'Application failed to respond' the project ID is 9bf1df8d-fa05-4e4c-ba99-360b9f4688b0
18 Replies
Percy
Percy•16mo ago
Project ID: 9bf1df8d-fa05-4e4c-ba99-360b9f4688b0
rafael.soteldo
rafael.soteldo•16mo ago
thank you @Brody, I'll read it
Brody
Brody•16mo ago
friendly reminder, please no pings #🛂|readme #5
rafael.soteldo
rafael.soteldo•16mo ago
I want to deploy a react app but it is contenerized with Docker
Brody
Brody•16mo ago
yes that is how railway works what seems to be the problem?
rafael.soteldo
rafael.soteldo•16mo ago
that I think that 'Getting Your Create-React-App Running on Railway' is for non docker apps
Brody
Brody•16mo ago
I wrote that specifically for getting your app running on railway, the presence of docker is irrelevant in this situation, please follow the guide
rafael.soteldo
rafael.soteldo•16mo ago
ok but I'm using the build of the app, the app is already written, and I also use nginx, as the server, instead of the default server.
Brody
Brody•16mo ago
okay so you've already got a far more complex app than the default create react app is please share your repo so I can advise further
rafael.soteldo
rafael.soteldo•16mo ago
I'm trying to get rid of nginx, it is not working as it should, I'm going back to the use of the node default server, I'll let you know when I'm done
Brody
Brody•16mo ago
use serve like the guide suggested
rafael.soteldo
rafael.soteldo•16mo ago
I used server, when deploying it, the logs are succesfull, the deploy logs in the Railway page, say 'INFO Accepting connections at http://localhost:3000'. the build logs don't mention any error, but the Details say 'Dockerfile on failure'. when I go to the address 'menufrontapp-production-788f.up.railway.app', it says 'Application failed to respond' the id Project ID is: 7d716c40-ff21-44d0-8eb7-8bfb69c8c7e3 serve*, I used serve
Brody
Brody•16mo ago
then please please just read the guide
rafael.soteldo
rafael.soteldo•16mo ago
ok I keep getting an error: This is my Dockerfile.
# Use the node:alpine base image
FROM node:alpine

# Set the working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json to the container
COPY package.json package-lock.json ./

# Install dependencies
RUN npm ci

# Copy the rest of the web directory to the container
COPY . .

# Install 'serve' globally (for production)
RUN npm install -g serve

# Expose port 3000 for the web server
EXPOSE 3000

# Serve the built application using 'serve' with the specified options
CMD ["serve", "build", "-s", "-n", "-l", "3000"]
# Use the node:alpine base image
FROM node:alpine

# Set the working directory inside the container
WORKDIR /app

# Copy package.json and package-lock.json to the container
COPY package.json package-lock.json ./

# Install dependencies
RUN npm ci

# Copy the rest of the web directory to the container
COPY . .

# Install 'serve' globally (for production)
RUN npm install -g serve

# Expose port 3000 for the web server
EXPOSE 3000

# Serve the built application using 'serve' with the specified options
CMD ["serve", "build", "-s", "-n", "-l", "3000"]
my package.json scripts is:
"scripts": {
"start": "serve build -s -n -L -p ${PORT:-3000}",
"build": "react-scripts build",
"serve": "react-scripts start"
},
"scripts": {
"start": "serve build -s -n -L -p ${PORT:-3000}",
"build": "react-scripts build",
"serve": "react-scripts start"
},
Could you tell me what am i doing wrong?
Brody
Brody•16mo ago
Could you tell me what am i doing wrong?
not reading my guide closely enough more specifically? not using $PORT in your dockerfile you dont need a dockerfile in this instance, please delete it
rafael.soteldo
rafael.soteldo•16mo ago
ok, I am deploying it without the Dockerfile but, what do I do: railway up?
Brody
Brody•16mo ago
aren't you using a github repo?
Want results from more Discord servers?
Add your server