Reputation: 135
I want to build Docker image that runs a PHP app. The source code is stored in a private GitHub repository.
Should I either:
or
./app
directory and only COPY ./app /app
it inside the Dockerfile.If this changes anything, all my GitHub repositories are private, and I store my images in a private Docker Hub repositories.
Upvotes: 1
Views: 922
Reputation: 4099
It's generally not a good idea to load SSH keys into docker and pull source from git. You should use option 2. Use CI/CD pipeline to pull source code from repo and then copy it into your docker image.
We do this for all our production pipelines. We create deploy keys on github and then use Circle CI to pull source and build docker images.
Upvotes: 2