waltcow
HOBBYOP
a year ago
https://docs.railway.app/guides/dockerfiles
Railway supports cache mounts in your Dockerfile in the following format:
--mount=type=cache,id=s/-,target=
Replace with the id of the service.
FROM node:16 as builder
WORKDIR /build
COPY web/package.json .
ARG RAILWAY_SERVICE_ID
RUN --mount=type=cache,id=s/${RAILWAY_SERVICE_ID}-node_modules,target=node_modules
RUN npm installbuild logs
[Region: us-west1]
Cache mount ID is not prefixed with cache keywhy RAILWAYSERVICEID can not be retrieved in build time?
4 Replies
brody
EMPLOYEE
a year ago
that is not supported syntax, you need to hardcode the service id
brody
EMPLOYEE
a year ago
Replace with the id of the service.