Looking to deploy a react vite frontend with a Dockerfile, seem to get error and no logs

Hey, it seems like this should be a fairly simple task to perform, but I'm looking for help. Here's my Dockerfile
# Use a Node.js base image
FROM node:18

# Set the working directory in the Docker container
WORKDIR /app

# Install the 'serve' package globally
RUN npm install -g serve

# Copy the built static files from your dist folder to the Docker image
COPY ./dist /app

# Expose the port that 'serve' will run on
EXPOSE 80

# Command to serve the app using 'serve'
CMD ["serve", "-s", ".", "-l", "80"]
# Use a Node.js base image
FROM node:18

# Set the working directory in the Docker container
WORKDIR /app

# Install the 'serve' package globally
RUN npm install -g serve

# Copy the built static files from your dist folder to the Docker image
COPY ./dist /app

# Expose the port that 'serve' will run on
EXPOSE 80

# Command to serve the app using 'serve'
CMD ["serve", "-s", ".", "-l", "80"]
The result I get is: Application failed to respond Any help would be great thanks
Solution:
you can do this easy enough with nixpacks. https://github.com/brody192/vite-react-template delete your Dockerfile, then copy the nixpacks.toml and Caddyfile into your project....
Jump to solution
7 Replies
Percy
Percy4mo ago
Project ID: 7efe54ff-c124-413a-a5d4-87a4ea16ec67
morganmoskalyk
morganmoskalyk4mo ago
7efe54ff-c124-413a-a5d4-87a4ea16ec67
Solution
Brody
Brody4mo ago
you can do this easy enough with nixpacks. https://github.com/brody192/vite-react-template delete your Dockerfile, then copy the nixpacks.toml and Caddyfile into your project. if you have a start command set in your railway service settings, remove it
morganmoskalyk
morganmoskalyk4mo ago
hey, thanks for the reponse. preference is to not use Caddy. is there a way accomplish this with a Dockerfile?
Brody
Brody4mo ago
yes of course this can be done with a dockerfile. but may I ask why you'd rather use a node based server instead of a server like caddy?
morganmoskalyk
morganmoskalyk4mo ago
i don't like the name, never heard of it before, and most people use docker
Brody
Brody4mo ago
caddy is a production ready web server, like nginx but better https://caddyserver.com/