I am trying to set up a build process for a project and am running into an issue with using arg in the COPY command.
Part of the process is the build of a library into an image, that is used by multiple other images. The problem occurs in the following lines:
ARG BUILD_CONFIG=dev
COPY --from=company/mu_library:${BUILD_CONFIG} /some/path /other/path
According to the error message, the ${BUILD_CONFIG}
is never translated into dev
. When adding an echo line beforehand, the echo prints dev
.
ARG BUILD_CONFIG=dev
RUN echo ${BUILD_CONFIG}
COPY --from=company/mu_library:${BUILD_CONFIG} /some/path /other/path
Does anyone have an idea how to go around it without creating duplicate stages in the dockerfile that all point to separate tags?
EDIT: Minimal Dockerfile
FROM node:12.15:0 as prod
ARG BUILD_CONFIG=dev
RUN echo ${BUILD_CONFIG}
COPY --from=test/test-library:${BUILD_CONFIG} /work/dist /work/library/dist
CMD[ "bash" ]
Error:
invalid from flag value test/test-library:${BUILD_CONFIG}: invalid reference format