2 years ago
Running a project on Docker, project runs locally, but not here. Here's how my Dockerfile looks like:
FROM node:20-alpine
WORKDIR /app
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY package.json ./
COPY pnpm-lock.yaml ./
RUN --mount=type=cache,id=15e39893-903d-4d7a-97e0-f6f37a9da580,target=/pnpm/store pnpm install --frozen-lockfile
COPY . ./
RUN pnpm run build
EXPOSE 80
ENV SERVER__PORT=80
ENV NODE_ENV=production
CMD ["pnpm", "run", "start"]I'd like to avoid sharing my repo if that's possible.
11 Replies
2 years ago
please read this docs section -
app should be running on 0.0.0.0:80 if i want it running on a domain, correct?
2 years ago
please read this docs page -
oh really sorry, didn't see that the env for port doesnt show, that'll be all, thanks for your help
2 years ago
please read the last link a little more carefully, you do not want to be setting your own PORT variable as the documentation clearly recommends against that method
2 years ago
where does .env come into play here?
const port = process.env.PORT
uses the host's env not mine, i havent set a custom PORT variableThe PORT variable is automatically injected by Railway into your application's environment. i was confused by this because it didn't show under variables
2 years ago
okay then you should be all set
2 years ago
no problem