Container failed to start

I am trying to deploy and when railway is doing the build it seems to "complete" without errors, but the container fails to start and I am unsure why.. I have tried a few things I found online like setting up a dockerFile, nginx.conf and testing a local build.. Building it locally everything seems to run fine with no issues, but when building via railway it seems to fail at the end..
No description
Solution:
remove them
Jump to solution
22 Replies
Percy
Percy3mo ago
Project ID: 4192a00e-89d7-4e81-be01-005041c8e063
gitago_texts
gitago_textsOP3mo ago
4192a00e-89d7-4e81-be01-005041c8e063
gitago_texts
gitago_textsOP3mo ago
No description
gitago_texts
gitago_textsOP3mo ago
# Use an official Node.js runtime as a parent image
FROM node:20 as build

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Specify the environment variable
ARG ACCESS_TOKEN
ENV ACCESS_TOKEN=$ACCESS_TOKEN

# Build the application
RUN npm run build

# Use an official Nginx image to serve the build
FROM nginx:alpine

# Remove the default Nginx configuration file
RUN rm /etc/nginx/conf.d/default.conf

# Copy the build output to the Nginx html directory
COPY --from=build /app/build /usr/share/nginx/html

# Copy custom Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Expose port 80
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
# Use an official Node.js runtime as a parent image
FROM node:20 as build

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Specify the environment variable
ARG ACCESS_TOKEN
ENV ACCESS_TOKEN=$ACCESS_TOKEN

# Build the application
RUN npm run build

# Use an official Nginx image to serve the build
FROM nginx:alpine

# Remove the default Nginx configuration file
RUN rm /etc/nginx/conf.d/default.conf

# Copy the build output to the Nginx html directory
COPY --from=build /app/build /usr/share/nginx/html

# Copy custom Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Expose port 80
EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
Adam
Adam3mo ago
Please download and send your whole log file, not just the failed to start error
gitago_texts
gitago_textsOP3mo ago
not seeing any obvious way to download it, so heres a copy paste.
gitago_texts
gitago_textsOP3mo ago
well that didnt work is there no copy log/download log option? 😐
Brody
Brody3mo ago
From experience, the full build logs will not provide any more information, as the build itself has succeeded. maybe they have an incorrect start command set in the service settings? ctrl / cmd + k -> search logs
gitago_texts
gitago_textsOP3mo ago
checked several screens when presing ctrl+k and none of them came up with anything to do with copying/downloading the logs
No description
Brody
Brody3mo ago
it's somewhere, maybe that's the wrong search term either way, logs won't help here, your build did succeed do you have a start command set in the service settings?
gitago_texts
gitago_textsOP3mo ago
yes, react-scripts start
Brody
Brody3mo ago
remove it
gitago_texts
gitago_textsOP3mo ago
o wait thats the package.json im sorry.. but inside of the actual settings i do have a customs tartup cvommand too
Solution
Brody
Brody3mo ago
remove them
gitago_texts
gitago_textsOP3mo ago
got it well then.. that seemed to do it.. Appreciate your help very much.. This is my first time ever using a docker, also a VPS host... 😛 went pretty smooth overall
Brody
Brody3mo ago
railway isn't a VPS host 🙂
gitago_texts
gitago_textsOP3mo ago
tell me im a noob, without telling me im a noob go ahead
Brody
Brody3mo ago
hahaha
gitago_texts
gitago_textsOP3mo ago
... you dont need to explain.. just know im clueless but ill figure it out.. i always do 🙂 thanks for the great platform
Brody
Brody3mo ago
I'm just the support guy, but thank you
gitago_texts
gitago_textsOP3mo ago
without you, i'd be lost.. soo thanks goes to you still 🙂 I do support on another discord for a piece of software so I know what its like 😛
Brody
Brody3mo ago
ouuu software, support sounds fun
Want results from more Discord servers?
Add your server