Improving centos mirror Dockerfile

Change-Id: Ifb8235fa15e99297c50741ab0fcbb065a4d5f626
This commit is contained in:
Guillermo Ponce 2018-06-20 14:11:07 -05:00
parent 561162cad6
commit c93dfe9126
3 changed files with 19 additions and 8 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@
.tox .tox
localrc localrc
toCOPY/.gitconfig toCOPY/.gitconfig
centos-mirror-tools/logs/
centos-mirror-tools/output/

View File

@ -2,21 +2,24 @@
FROM centos:7.4.1708 FROM centos:7.4.1708
WORKDIR /localdisk
#ENV http_proxy "http://your.actual_http_proxy.com:your_port" #ENV http_proxy "http://your.actual_http_proxy.com:your_port"
#ENV https_proxy "https://your.actual_https_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" #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 epel-release sudo vim-enhanced net-tools \
RUN yum install -y /usr/bin/yumdownloader rpm-build rpm-sign deltarpm wget bind bind-utils /usr/bin/yumdownloader rpm-build rpm-sign deltarpm wget bind \
bind-utils && rm /etc/yum.repos.d/CentOS-Sources.repo \
RUN rm /etc/yum.repos.d/CentOS-Sources.repo && \ /etc/yum.repos.d/epel.repo
rm /etc/yum.repos.d/epel.repo
COPY StarlingX.repo /etc/yum.repos.d COPY StarlingX.repo /etc/yum.repos.d
COPY rpm-gpg-keys/* /etc/pki/rpm-gpg/ COPY rpm-gpg-keys/* /etc/pki/rpm-gpg/
RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* RUN rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
WORKDIR /localdisk ENTRYPOINT ["/bin/bash"]

View File

@ -14,7 +14,13 @@ $ docker build -t <your_docker_image_name>:<your_image_version> -f Dockerfile .
The container shall be run from the same directory where the other scripts are stored. The container shall be run from the same directory where the other scripts are stored.
``` ```
$ docker run -it -v $(pwd):/localdisk <your_docker_image_name>:<your_image_version> bash $ docker run -it -v $(pwd):/localdisk <your_docker_image_name>:<your_image_version>
```
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 <your_docker_image_name>:<your_image_version> 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. 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.