I am attempting to create a docker image that can optionally incorporate a yarn or npm lockfile during the build process. I want to include it explicitly, but also ensure that the build does not fail if the lockfile is missing.
The goal is to respect deterministic build processes used by hosted applications without enforcing them. Additionally, I aim to allow applications to utilize this container for establishing deterministic builds.
Below is my initial setup:
FROM node:8.12.0-alpine
USER node
WORKDIR ${my_workdir}
COPY --chown=node:node src/yarn.lock ./
COPY --chown=node:node src/package*.json ./
RUN yarn && yarn cache clean
COPY --chown=node:node src/ .
CMD []
Is there a specific command or option I could implement instead of 'copy' that will not cause an error if the 'src/yarn.lock' file is missing from the filesystem?