How to find Service ID - Docker Cache Mounts
Hi, how can i find my service id?
I have cache mounts in my dockerfile, and railway wants me to provide an id, which I've been told is supposed to be my service id.
18 Replies
Project ID:
N/A
You can find your service ID in the URL when you go to your service
railway.app/project/PROJECT_ID/service/SERVICE_ID
thanks
happy to help 🙂
sorry, i'm now getting Cache mount ID is not prefixed with cache key
offending code
RUN --mount=type=cache,id=<service_id>,target=/go/pkg/mod/ \
same for
go build
It's now throwing: Invalid cache mounts
However, it still works locally.
full example
RUN --mount=type=cache,id=s/<service_id>/root/cache/go-build,target=/root/.cache/go-build \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x
do i need to change the targets?
please try with the exact line I gave before you start modifying it
ok,
it's just i need to use
RUN --mount=type=cache,id=s/<service_id>/root/cache/go-build,target=/root/.cache/go-build \
apk --update add \
ca-certificates \
tzdata \
&& \
update-ca-certificates
and
RUN --mount=type=cache,id=s/<service_id>/root/cache/go-build,target=/root/.cache/go-build \
--mount=type=bind,target=. \
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server ./
as well
#11 0.400 go: no modules specified (see 'go help mod download')
it doesn't seem to like bind mounts
are you making sure to copy in your go.mod and go.sum files before running go mod download?
yes so don't use them lol
how about you send your current dockerfile?
I've only ever used my own dockerfiles that don't use mount catches and build time is always somewhere around 10 or 15 seconds for the entire build
please enclose it in triple backticks
looks kinda overly complex tbh
maybe, i just need to get the exe, mod and sum + the last 2 lines
exe huh?
i mean get the build
keep it simple
thanks
managed to do it, just needed to copy local packages and files as well
bit of a mess but it works
great!