Cache mount ID is not prefixed with cache key
0xqueen
HOBBYOP

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

brody
EMPLOYEE

2 years ago

please read this docs section -


0xqueen
HOBBYOP

2 years ago

app should be running on 0.0.0.0:80 if i want it running on a domain, correct?


brody
EMPLOYEE

2 years ago

please read this docs page -


0xqueen
HOBBYOP

2 years ago

oh really sorry, didn't see that the env for port doesnt show, that'll be all, thanks for your help


brody
EMPLOYEE

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


0xqueen
HOBBYOP

2 years ago

yeah, i just made it use .env, i havent set a custom port variable


brody
EMPLOYEE

2 years ago

where does .env come into play here?


0xqueen
HOBBYOP

2 years ago

const port = process.env.PORT

uses the host's env not mine, i havent set a custom PORT variable
The PORT variable is automatically injected by Railway into your application's environment. i was confused by this because it didn't show under variables


brody
EMPLOYEE

2 years ago

okay then you should be all set


0xqueen
HOBBYOP

2 years ago

thanks for your help


brody
EMPLOYEE

2 years ago

no problem


Loading...