...
The main steps for the Dockerfile are:
Create a
.ssh
folder.Copy the deploy key into the
.ssh
folder.Add gitlab server to
known_hosts
file.Setup
.ssh/config
file to explicitly specify the deploy key and username to be used.Clone the repo.
Here is some example Dockerfile code.
Code Block RUN mkdir -p /root/.ssh && chmod 700 /root/.ssh ADD id_rsa_ece_li_scheduling_deploy /root/.ssh/id_rsa_ece_li_scheduling_deploy RUN chmod 600 /root/.ssh/id_rsa_ece_li_scheduling_deploy RUN ssh-keyscan -H git.uwaterloo.ca >> /root/.ssh/known_hosts RUN echo "Host git.uwaterloo.ca\n\ HostName git.uwaterloo.ca\n\ IdentityFile /root/.ssh/id_rsa_ece_li_scheduling_deploy\n\ StrictHostKeyChecking no\n\ User ist-git" >> /root/.ssh/config RUN chmod 600 /root/.ssh/config RUN git clone ist-git@git.uwaterloo.ca:d24lau/ece_li_scheduling.git
ALLOWED_HOSTS
Modify ALLOWED_HOSTS.