R
Railwayβ€’2y ago
awnion

Docker `RUN --mount=type=bind,target=.` support

Any plans on supporting bind mounts? Because it's quite convenient to do
RUN --mount=. go build
RUN --mount=. go build
instead of
COPY . .
RUN go build
COPY . .
RUN go build
5 Replies
Percy
Percyβ€’2y ago
Project ID: N/A
awnion
awnionOPβ€’2y ago
N/A
Brody
Brodyβ€’2y ago
I've never seen someone do that instead of using COPY there's no reason railway should support something so very non-standard imo
awnion
awnionOPβ€’2y ago
Docker officially do this and also it's a common practice: https://github.com/docker/compose/blob/v2/Dockerfile#L65 https://github.com/docker/buildx/blob/master/Dockerfile#L72 and so on... Search for --mount=type=bind and --mount=. they are the same. The point is when you bind you can restrict write (while you copy you lose control) + files stay in the intermediate layer in your local cache like "come on man" πŸ™‚ Also it's faster (especially on Mac with gGRP transport). That's ok if you don't want to implement it. I get it. Just add it into documentation plz because it's not obvious at all. The build just breaks while it works locally and looks fine -- the worst type of error πŸ™‚ Also both COPY and --mount=type=bind can't get access to files outside of the context directory and can't access files mentioned in .dockerignore.
awnion
awnionOPβ€’2y ago
BTW no offence but the official documentation is literally saying to get rid of COPY 🀣 https://docs.docker.com/build/guide/mounts/#add-bind-mounts
Want results from more Discord servers?
Add your server