From c93dfe91262ecebe3a89b741b5f1257e7413cb4b Mon Sep 17 00:00:00 2001 From: Guillermo Ponce Date: Wed, 20 Jun 2018 14:11:07 -0500 Subject: [PATCH] Improving centos mirror Dockerfile Change-Id: Ifb8235fa15e99297c50741ab0fcbb065a4d5f626 --- .gitignore | 2 ++ centos-mirror-tools/Dockerfile | 17 ++++++++++------- centos-mirror-tools/README.md | 8 +++++++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index c54ed2c6..766c4b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ .tox localrc toCOPY/.gitconfig +centos-mirror-tools/logs/ +centos-mirror-tools/output/ diff --git a/centos-mirror-tools/Dockerfile b/centos-mirror-tools/Dockerfile index a5d2d5d3..d66ca151 100644 --- a/centos-mirror-tools/Dockerfile +++ b/centos-mirror-tools/Dockerfile @@ -2,21 +2,24 @@ FROM centos:7.4.1708 +WORKDIR /localdisk + #ENV http_proxy "http://your.actual_http_proxy.com:your_port" #ENV https_proxy "https://your.actual_https_proxy.com:your_port" #ENV ftp_proxy "http://your.actual_ftp_proxy.com:your_port" -#RUN echo "proxy=http://your-proxy.com:port" >> /etc/yum.conf +#RUN echo "proxy=$http_proxy" >> /etc/yum.conf && \ +# echo -e "export http_proxy=$http_proxy\nexport https_proxy=$https_proxy\n\ +#export ftp_proxy=$ftp_proxy" >> /root/.bashrc -RUN yum install -y epel-release sudo vim-enhanced net-tools -RUN yum install -y /usr/bin/yumdownloader rpm-build rpm-sign deltarpm wget bind bind-utils - -RUN rm /etc/yum.repos.d/CentOS-Sources.repo && \ - rm /etc/yum.repos.d/epel.repo +RUN yum install -y epel-release sudo vim-enhanced net-tools \ + /usr/bin/yumdownloader rpm-build rpm-sign deltarpm wget bind \ + bind-utils && rm /etc/yum.repos.d/CentOS-Sources.repo \ + /etc/yum.repos.d/epel.repo COPY StarlingX.repo /etc/yum.repos.d COPY rpm-gpg-keys/* /etc/pki/rpm-gpg/ RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* -WORKDIR /localdisk +ENTRYPOINT ["/bin/bash"] diff --git a/centos-mirror-tools/README.md b/centos-mirror-tools/README.md index 4fb46034..dfad0891 100644 --- a/centos-mirror-tools/README.md +++ b/centos-mirror-tools/README.md @@ -14,7 +14,13 @@ $ docker build -t : -f Dockerfile . The container shall be run from the same directory where the other scripts are stored. ``` -$ docker run -it -v $(pwd):/localdisk : bash +$ docker run -it -v $(pwd):/localdisk : +``` + +The container can also be run the following way, so the `download_mirror.sh` runs automatically without having to enter the container and the step 2can be simplified. + +``` +$ docker run -it -v $(pwd):/localdisk : download_mirror.sh ``` As `/localdisk` is defined as the workdir of the container, the same folder name should be used to define the volume. The container will start to run and populate a `logs` and `output` folders in this directory.