Skip to content

Instantly share code, notes, and snippets.

@SajidK25
Last active January 16, 2022 11:51
Show Gist options
  • Save SajidK25/e42b54c4cc6f7cd96426073d944e2d9a to your computer and use it in GitHub Desktop.
Save SajidK25/e42b54c4cc6f7cd96426073d944e2d9a to your computer and use it in GitHub Desktop.
Multi Stage Dockerfile using sshkey
FROM ubuntu as intermidiate
RUN apt-get update
RUN apt-get install git -y
RUN mkdir /root/.ssh/ && \
chmod 700 /root/.ssh
COPY id_ed25519 /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan -t rsa -H github.com >> /root/.ssh/known_hosts
# RUN ssh-keyscan -t rsa -H gitlab.com >> /root/.ssh/known_hosts
# RUN ssh -T git@github.com
RUN git clone git@github.com:SajidK25/Python_CWM.git
FROM ubuntu
COPY --from=intermidiate /Python_CWM /srv/Python_CWM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment