R
Railway7mo ago
Queen

Cache mount ID is not prefixed with cache key

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"]
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.
12 Replies
Percy
Percy7mo ago
Project ID: 15e39893-903d-4d7a-97e0-f6f37a9da580
Brody
Brody7mo ago
Queen
QueenOP7mo ago
app should be running on 0.0.0.0:80 if i want it running on a domain, correct?
Brody
Brody7mo ago
Queen
QueenOP7mo ago
oh really sorry, didn't see that the env for port doesnt show, that'll be all, thanks for your help
Brody
Brody7mo 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
Queen
QueenOP7mo ago
yeah, i just made it use .env, i havent set a custom port variable
Brody
Brody7mo ago
where does .env come into play here?
Queen
QueenOP7mo 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
Brody7mo ago
okay then you should be all set
Queen
QueenOP7mo ago
thanks for your help
Brody
Brody7mo ago
no problem
Want results from more Discord servers?
Add your server