github.com/swiftstack/proxyfs@v0.0.0-20201223034610-5434d919416e/saio/container/Dockerfile (about)

     1  FROM centos:7.4.1708
     2  
     3  ARG SwiftVersion=ss-release-2.26.0.5
     4  ARG GolangVersion=1.15.5
     5  ARG ProxyFS_Version=stable
     6  
     7  ENV GolangBasename "go${GolangVersion}.linux-amd64.tar.gz"
     8  ENV GolangURL      "https://golang.org/dl/${GolangBasename}"
     9  
    10  RUN yum install -y yum-utils
    11  
    12  RUN yum-config-manager --disable CentOS-Base
    13  RUN yum-config-manager --disable CentOS-CR
    14  RUN yum-config-manager --disable CentOS-Debuginfo
    15  RUN yum-config-manager --disable CentOS-fasttrack
    16  RUN yum-config-manager --disable CentOS-Media
    17  RUN yum-config-manager --disable CentOS-Sources
    18  RUN yum-config-manager --disable CentOS-Vault
    19  
    20  RUN rm -rf /etc/yum.repos.d/CentOS-Base.repo
    21  RUN rm -rf /etc/yum.repos.d/CentOS-CR.repo
    22  RUN rm -rf /etc/yum.repos.d/CentOS-Debuginfo.repo
    23  RUN rm -rf /etc/yum.repos.d/CentOS-fasttrack.repo
    24  RUN rm -rf /etc/yum.repos.d/CentOS-Media.repo
    25  RUN rm -rf /etc/yum.repos.d/CentOS-Sources.repo
    26  RUN rm -rf /etc/yum.repos.d/CentOS-Vault.repo
    27  
    28  RUN yum-config-manager --add-repo http://vault.centos.org/centos/7.4.1708/os/x86_64/
    29  RUN yum-config-manager --add-repo http://vault.centos.org/centos/7.4.1708/updates/x86_64/
    30  RUN yum-config-manager --add-repo http://vault.centos.org/centos/7.4.1708/extras/x86_64/
    31  RUN yum-config-manager --add-repo http://vault.centos.org/centos/7.4.1708/centosplus/x86_64/
    32  RUN yum-config-manager --enable vault.centos.org_centos_7.4.1708_os_x86_64_
    33  RUN yum-config-manager --enable vault.centos.org_centos_7.4.1708_updates_x86_64_
    34  RUN yum-config-manager --enable vault.centos.org_centos_7.4.1708_extras_x86_64_
    35  RUN yum-config-manager --enable vault.centos.org_centos_7.4.1708_centosplus_x86_64_
    36  
    37  RUN yum clean all
    38  
    39  RUN yum install -y wget
    40  RUN yum install -y git
    41  
    42  RUN yum install -y --disableexcludes=all glibc-common gcc
    43  
    44  RUN useradd --user-group --groups wheel swift
    45  RUN chmod 755 ~swift
    46  
    47  RUN yum install -y attr
    48  RUN yum install -y e2fsprogs
    49  
    50  RUN mkdir -p /srv
    51  RUN truncate -s 1GB /srv/swift-disk
    52  RUN echo "y" | mkfs.ext4 -I 4096 /srv/swift-disk
    53  RUN mkdir -p /srv/1/node/sdb1
    54  RUN echo "/srv/swift-disk /srv/1/node/sdb1 ext4 loop,noatime,nodiratime,nobarrier 0 0" >> /etc/fstab
    55  
    56  RUN mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4
    57  RUN chown swift:swift /var/cache/swift*
    58  RUN mkdir -p /var/run/swift
    59  RUN chown swift:swift /var/run/swift
    60  
    61  RUN yum install -y \
    62      memcached \
    63      sqlite \
    64      xfsprogs \
    65      libffi-devel \
    66      xinetd \
    67      openssl-devel \
    68      python-setuptools \
    69      python-coverage \
    70      python-devel \
    71      python-nose \
    72      pyxattr \
    73      python-eventlet \
    74      python-greenlet \
    75      python-paste-deploy \
    76      python-netifaces \
    77      python-dns \
    78      python-mock
    79  
    80  RUN yum install -y centos-release-scl
    81  RUN yum install -y rh-python36
    82  RUN ln -s /opt/rh/rh-python36/root/bin/python3.6 /bin/python3.6
    83  RUN ln -s /bin/python3.6 /bin/python3
    84  RUN ln -s /opt/rh/rh-python36/root/usr/include /opt/rh/rh-python36/root/include
    85  
    86  RUN yum install -y epel-release
    87  RUN yum install -y python-pip
    88  RUN pip install --upgrade pip
    89  RUN pip install --upgrade setuptools
    90  
    91  WORKDIR /home/swift
    92  RUN git clone https://github.com/openstack/liberasurecode.git
    93  WORKDIR /home/swift/liberasurecode
    94  RUN yum install -y gcc make autoconf automake libtool
    95  RUN ./autogen.sh
    96  RUN ./configure
    97  RUN make
    98  RUN make install
    99  RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/liberasurecode.conf
   100  RUN ldconfig
   101  
   102  WORKDIR /home/swift
   103  RUN git clone https://github.com/openstack/pyeclib.git
   104  WORKDIR /home/swift/pyeclib
   105  RUN pip install -e .
   106  RUN pip install -r test-requirements.txt
   107  
   108  WORKDIR /home/swift
   109  RUN git clone https://github.com/swiftstack/swift.git
   110  WORKDIR /home/swift/swift
   111  RUN git checkout $SwiftVersion
   112  RUN pip install wheel
   113  RUN python setup.py bdist_wheel
   114  RUN yum remove -y python-greenlet
   115  RUN pip install --constraint py2-constraints.txt -r requirements.txt
   116  RUN python setup.py develop
   117  # The following avoid dependency on pip-installed pyOpenSSL being newer than required
   118  RUN pip install python-openstackclient==3.12.0 python-glanceclient==2.7.0
   119  # This is a temporary fix while bandit gets added to py2-constraints.txt
   120  RUN pip install bandit==1.6.2
   121  RUN pip install --constraint py2-constraints.txt -r test-requirements.txt
   122  
   123  # TODO: May need to do something about:
   124  #   systemctl enable memcached.service
   125  #   systemctl start memcached.service
   126  
   127  WORKDIR /etc/swift
   128  
   129  RUN rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
   130  RUN swift-ring-builder object.builder create 10 1 1
   131  RUN swift-ring-builder object.builder add r1z1-127.0.0.1:8010/sdb1 1
   132  RUN swift-ring-builder object.builder rebalance
   133  RUN swift-ring-builder object-1.builder create 10 1 1
   134  RUN swift-ring-builder object-1.builder add r1z1-127.0.0.1:8010/sdb1 1
   135  RUN swift-ring-builder object-1.builder rebalance
   136  RUN swift-ring-builder object-2.builder create 10 1 1
   137  RUN swift-ring-builder object-2.builder add r1z1-127.0.0.1:8010/sdb1 1
   138  RUN swift-ring-builder object-2.builder rebalance
   139  RUN swift-ring-builder container.builder create 10 1 1
   140  RUN swift-ring-builder container.builder add r1z1-127.0.0.1:8011/sdb1 1
   141  RUN swift-ring-builder container.builder rebalance
   142  RUN swift-ring-builder account.builder create 10 1 1
   143  RUN swift-ring-builder account.builder add r1z1-127.0.0.1:8012/sdb1 1
   144  RUN swift-ring-builder account.builder rebalance
   145  
   146  COPY etc/swift .
   147  RUN chown -R swift:swift .
   148  
   149  WORKDIR /opt/ProxyFS
   150  
   151  RUN rm -rf /var/log/proxyfsd
   152  RUN mkdir -p /var/log/proxyfsd
   153  RUN touch /var/log/proxyfsd/proxyfsd.log
   154  RUN chmod 777 /var
   155  RUN chmod 777 /var/log
   156  RUN chmod 777 /var/log/proxyfsd
   157  RUN chmod 666 /var/log/proxyfsd/proxyfsd.log
   158  
   159  RUN wget -nv $GolangURL
   160  RUN tar -C /usr/local -xzf $GolangBasename
   161  
   162  ENV GOPATH /opt/ProxyFS/GOPATH
   163  ENV PATH   $PATH:/usr/local/go/bin:$GOPATH/bin
   164  
   165  RUN yum install -y make fuse
   166  
   167  RUN mkdir -p $GOPATH/src/github.com/swiftstack
   168  WORKDIR $GOPATH/src/github.com/swiftstack
   169  RUN git clone https://github.com/swiftstack/ProxyFS.git
   170  WORKDIR $GOPATH/src/github.com/swiftstack/ProxyFS
   171  RUN git checkout $ProxyFS_Version
   172  
   173  RUN cd pfs_middleware  && python setup.py develop
   174  RUN cd meta_middleware && python setup.py develop
   175  
   176  RUN make version pre-generate generate install
   177  
   178  WORKDIR /opt/ProxyFS
   179  
   180  RUN mkdir     CommonMountPoint
   181  RUN chmod 777 CommonMountPoint
   182  
   183  RUN yum install -y rsyslog
   184  RUN echo "\$ModLoad imudp" >> /etc/rsyslog.conf
   185  RUN echo "\$UDPServerRun 514" >> /etc/rsyslog.conf
   186  
   187  COPY docker_startup.sh .
   188  COPY proxyfs.conf .
   189  RUN chmod +x docker_startup.sh
   190  
   191  CMD /opt/ProxyFS/docker_startup.sh
   192  
   193  # To build this image:
   194  #
   195  #   docker build \
   196  #          [--build-arg SwiftVersion=<branch-name-or-tag-or-SHA]     \
   197  #          [--build-arg GolangVersion=<major#.minor#[.patch#]>]      \
   198  #          [--build-arg ProxyFS_Version=<branch-name-or-tag-or-SHA>] \
   199  #          [-t <repository>:<tag>]                                   .
   200  
   201  # To run a container for this image:
   202  #
   203  #   docker run -d --rm --device /dev/fuse --device /dev/loop0 --cap-add SYS_ADMIN -p 15346:15346 saio-pfs