fix: Use Node.js serve for robust port binding on Railway
This commit is contained in:
parent
7116eb3466
commit
241a9d0dd7
1 changed files with 11 additions and 7 deletions
18
Dockerfile
18
Dockerfile
|
|
@ -1,10 +1,14 @@
|
||||||
FROM nginx:alpine
|
FROM node:20-alpine
|
||||||
|
|
||||||
# Copy static assets to Nginx html folder
|
# Install simple static file server
|
||||||
COPY . /usr/share/nginx/html
|
RUN npm install -g serve
|
||||||
|
|
||||||
# Expose port 80
|
# Create app directory
|
||||||
EXPOSE 80
|
WORKDIR /app
|
||||||
|
|
||||||
# Start Nginx
|
# Copy all files
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
COPY . .
|
||||||
|
|
||||||
|
# Start server on the port defined by Railway ($PORT)
|
||||||
|
# If $PORT is not set, default to 3000
|
||||||
|
CMD serve -s . -l tcp://0.0.0.0:${PORT:-3000}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue