I want to build Docker image that runs a PHP app. The source code is stored in a private GitHub repository.
Should I either:
- Copy some (my own or dedicated or my CI/CD's tool) SSH key inside the container (in the Dockerfile) and later remove it to authorize and clone the repository from GitHub, like here: Clone private git repo with dockerfile
or
- Use my own (or my CI/CD's tools) environment to clone the repository to the
./app
directory and onlyCOPY ./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.