My Dockerfile builds an image copying the content of the current working directory, but always uses the master branch. I would like to specify a branch during the COPY or ADD operation.
FROM node:10.18.0-stretch EXPOSE 81 8080 RUN apt-get update; \ apt-get install -y \ ssh \ git-core \ COPY ./ /var/www/app_source WORKDIR /var/www/app_source RUN npm i npm@latest \ && npm install \ && npm install pm2@latest -g CMD [ "pm2-runtime", "app.js" ]
The above will always build the image using the master branch, whereas I'd like to specify a staging branch. A less elegant solution is to git clone -b staging https://github.com/example/app_source.git and build from that directory which will work given there's no other branch there.
However, I'd like to continue developing on the current master branch but build images using any branch on my local workstation.
Any ideas, responses are appreciated.