This is still experimental and shouldn't be used for production builds. If you want to use secrets you should use multi-stage builds. For example:
FROM node:12 as baseFROM base as buildCOPY ./keys/id_rsa /root/.ssh/id_rsaWORKDIR /app# some private repositories are listed in the dependenciesCOPY ./package.json /app/package.json# install private packagesRUN npm installFROM baseCOPY --from=build /app/node_modules /app/node_modules
This is still experimental and shouldn't be used for production builds. If you want to use secrets you should use multi-stage builds. For example:
Yep, that's a very good method if you are using multistage build. I talk about it here gasparevitta.com/posts/advanced-do...