R
Railway13mo ago
CoCa

Static Site using Nginx + Railway domain not loading

I have a SvelteKit static site I'm trying to deploy using this Dockerfile:
FROM node:alpine3.18 as builder
RUN mkdir /code
WORKDIR /code
COPY . /code
RUN npm install
RUN npm run build

FROM nginx:alpine3.18-slim
COPY --from=builder /code/dist /usr/share/nginx/html
FROM node:alpine3.18 as builder
RUN mkdir /code
WORKDIR /code
COPY . /code
RUN npm install
RUN npm run build

FROM nginx:alpine3.18-slim
COPY --from=builder /code/dist /usr/share/nginx/html
(somewhat copied from here - https://github.com/railwayapp-templates/nginx/blob/main/Dockerfile) The build + deploy succeeded, and I generated a railway domain for it but I'm only seeing the "Application failed to respond" page. Is there something network-related I'm missing?
11 Replies
Percy
Percy13mo ago
Project ID: bc2b0c44-e8c1-44a3-9e7e-58f076541628
CoCa
CoCa13mo ago
bc2b0c44-e8c1-44a3-9e7e-58f076541628
Brody
Brody13mo ago
just have nginx listen on 8080 and then set a PORT service variable to 8080 that's what the template does and that's what you're missing
CoCa
CoCa13mo ago
I'll do that Awesome, that was it! - totally missed that, thanks @Brody
Brody
Brody13mo ago
no problem!
FerDev
FerDev12mo ago
Hi, everybody This should be do in the docker file?
FerDev
FerDev12mo ago
Why if i'll set a PORT variable with the 8080 value it works? Shouldn't you create a relation somewhere in the site or docker file to that port variable?
Brody
Brody12mo ago
nginx needs to listen on 8080 too
FerDev
FerDev12mo ago
So is Railway who understand if the PORT variable is setted it should run in that port?
Brody
Brody12mo ago
you first need to configure nginx to listen on 8080 yourself, then you set a PORT service variable to 8080 so that railway knows nginx is running on port 8080 for further help can you please open your own #✋|help thread?
Want results from more Discord servers?
Add your server