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