Skip to content

Instantly share code, notes, and snippets.

@gorshkov-leonid
Last active October 3, 2019 08:23
Show Gist options
  • Save gorshkov-leonid/56693e30b2d90de05d302262204d9706 to your computer and use it in GitHub Desktop.
Save gorshkov-leonid/56693e30b2d90de05d302262204d9706 to your computer and use it in GitHub Desktop.
ubuntu
#add separate repo list and update
RUN sudo touch /etc/apt/sources.list.d/myrepo.list
RUN sudo /bin/bash -c 'echo "deb http://myrepo.corp/deb/ubuntu $(lsb_release -cs) main" >> /etc/apt/sources.list.d/myrepo.list'
RUN sudo /bin/bash -c 'echo "# deb-src myrepo.corp/deb/ubuntu $(lsb_release -cs) main" >> /etc/apt/sources.list.d/myrepo.list'
RUN sudo apt-get update -y -o Dir::Etc::sourcelist="sources.list.d/myrepo.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" || true
#add to global repos list
deb http://myrepo.corp/deb/ubuntu $(lsb_release -cs) main
#remove all repositories and add only corporate
echo "Remove repositories... " && \
grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* && \
bash -c 'echo "" > /etc/apt/sources.list' && rm -rf /var/lib/apt/lists/* && rm -rf /etc/apt/sources.list.d/* && apt-get clean && apt-get update && \
echo "Add Corp repositories... " && \
add-apt-repository "deb http://somerepo.corp/deb/ubuntu $(lsb_release -cs) main" && \
add-apt-repository "deb http://somerepo.corp/deb/ubuntu $(lsb_release -cs) restricted" && \
add-apt-repository "deb http://somerepo.corp/deb/ubuntu $(lsb_release -cs) universe" && \
apt-get update && \
apt-get -y install python-pip
#if sertificate is necessary
echo -n | `openssl s_client -servername somerepo.corp -connect somerepo.corp:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > repo.pem`
pip install yq --client-cert ./repo.pem --index-url https://somerepo.com/pypiproxy/simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment