msv-lab / modus

A language for building Docker/OCI container images
GNU Affero General Public License v3.0
279 stars 9 forks source link

Dockerfile COPY relative path #98

Closed maowtm closed 2 years ago

maowtm commented 2 years ago

Currently modus transpile doesn't work fully correctly because it turns out COPY --from=src_image . . in Dockerfile does not respect the WORKDIR property of src_image, and will instead resolve any relative path relative to /.

Example:

FROM alpine AS s1
WORKDIR /tmp
RUN echo hello > hello

FROM alpine
COPY --from=s1 hello hello
RUN cat hello
Step 4/6 : FROM alpine
 ---> c059bfaa849c
Step 5/6 : COPY --from=s1 hello hello
COPY failed: stat hello: file does not exist
maowtm commented 2 years ago

Note that this only affect transpile. Buildkit-based builds work correctly.

maowtm commented 2 years ago

Wontfix: transpile is not a supported feature.