Docker Community Forums

Share and learn in the Docker community.

Pulling out the code from github

dockerhub

(Ashokdockercloud007) #1

I want to create a image of my node.js application and my code is in the github,m how will i mention that in the docker file, so that docker file will pull the code from my github and create image??


(David Maze) #2

The usual pattern is to put the Dockerfile in the root of the application repository, alongside the package.json and what not, and run docker build on a checked-out application.

Nothing stops you from installing git in your image and running git clone, but (a) your running application image will have git in it, which is unnecessary, and (b) docker build will remember that it already ran the git clone step and give the same output as the previous run, which isn’t what you want if the repository contents are changing.