R
Railwayβ€’10mo ago
FrankHeijden

Cache mounts MUST be in the format --mount=type=cache,id=<cache-id>

New to railway, trying to deploy a docker image which builds a Node app. The quickstart from github immediately detected the Dockerfile -- yet it seems to immediately fail with the full build log below:
[Region: us-west1]
Cache mounts MUST be in the format --mount=type=cache,id=<cache-id>
[Region: us-west1]
Cache mounts MUST be in the format --mount=type=cache,id=<cache-id>
My dockerfile does not contain mounts with type cache, it only uses mounts with secrets. Is this unsupported by railway?
FROM node:20

RUN apt-get update \
&& apt-get install -y dumb-init

EXPOSE 8081
WORKDIR /app

# Build backend
RUN --mount=type=secret,id=NPM_GITHUB_TOKEN \
NPM_GITHUB_TOKEN=$(cat /run/secrets/NPM_GITHUB_TOKEN) \
npm install
RUN --mount=type=secret,id=SHOPIFY_ACCESS_TOKEN \
ABC_ACCESS_TOKEN=$(cat /run/secrets/ABC_ACCESS_TOKEN) \
npm run build

# Build frontend
WORKDIR ./frontend
RUN --mount=type=secret,id=NPM_GITHUB_TOKEN \
NPM_GITHUB_TOKEN=$(cat /run/secrets/NPM_GITHUB_TOKEN) \
npm install
RUN npm run build

# Run
WORKDIR ..
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["npm", "run", "serve"]
FROM node:20

RUN apt-get update \
&& apt-get install -y dumb-init

EXPOSE 8081
WORKDIR /app

# Build backend
RUN --mount=type=secret,id=NPM_GITHUB_TOKEN \
NPM_GITHUB_TOKEN=$(cat /run/secrets/NPM_GITHUB_TOKEN) \
npm install
RUN --mount=type=secret,id=SHOPIFY_ACCESS_TOKEN \
ABC_ACCESS_TOKEN=$(cat /run/secrets/ABC_ACCESS_TOKEN) \
npm run build

# Build frontend
WORKDIR ./frontend
RUN --mount=type=secret,id=NPM_GITHUB_TOKEN \
NPM_GITHUB_TOKEN=$(cat /run/secrets/NPM_GITHUB_TOKEN) \
npm install
RUN npm run build

# Run
WORKDIR ..
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["npm", "run", "serve"]
14 Replies
Percy
Percyβ€’10mo ago
Project ID: 1b92ecef-196c-4c1a-9ecf-09a0fd5d9a1b
FrankHeijden
FrankHeijdenOPβ€’10mo ago
1b92ecef-196c-4c1a-9ecf-09a0fd5d9a1b https://www.answeroverflow.com/m/1163144590686175393 it seems this lad got recommended to use build args -- why no secrets?
ThallesComH
ThallesComHβ€’10mo ago
hi, im unfamiliar with --mount-type, why do you need it? can't you just use environment variables?
FrankHeijden
FrankHeijdenOPβ€’10mo ago
build args persist in the final image https://docs.docker.com/build/building/secrets/ like these secrets would just be used for building the image I will probably as a workaround continue to build/publish to docker hub from github actions, then just use the image in railway directly brings me to my next roadblock, possibility of using a private docker hub image? Seems like there's no way to enter a token anywhere / link the account? https://discord.com/channels/713503345364697088/1180037087483920495/1180037087483920495 😒 and it seems for a ghcr.io private package no logs at all, just error after 7 mins which is weird since you connect your github to railway? so why can't it fetch the private packages
FrankHeijden
FrankHeijdenOPβ€’10mo ago
ah okay railway doesnt include the packages scope...
No description
Brody
Brodyβ€’10mo ago
railway does not support that kind of mount. all service variables are available as build args and then environment variables during runtime, there's no concept of separation. private images are not supported yet.
FrankHeijden
FrankHeijdenOPβ€’10mo ago
okay, i dont want build secrets to be bundled/accessible from the docker image, so that leaves the last option, using private docker images. Is there an eta on this feature? Should be relatively simple to add right?
Brody
Brodyβ€’10mo ago
it's planned, but I have no ETA for you, sorry
FrankHeijden
FrankHeijdenOPβ€’10mo ago
is this available in enterprise plans?
Brody
Brodyβ€’10mo ago
it's not implemented at all, but if someone on the enterprise plan where to request it, it would absolutely get it kickstarted
FrankHeijden
FrankHeijdenOPβ€’10mo ago
I have contacted email support for this issue, I am currently on the pro plan and pretty much blocked by this
Brody
Brodyβ€’10mo ago
that would be the most appropriate channel for this request!
FrankHeijden
FrankHeijdenOPβ€’10mo ago
Is email support really 2-3 business days? πŸ˜…
Brody
Brodyβ€’10mo ago
on the pro plan yes, on enterprise plans it's same day, or so I've heard https://docs.railway.app/reference/support#business-class-slos yes if I'm interpreting this correctly, it looks like it would be same business day for your current type of question
Want results from more Discord servers?
Add your server