Browse Source

Add Dockerfile to build a py3 swift docker image

This patch contains only a new Dockerfile and few changes to
be able to build both py2 and py3 images.

Next patch should contain changes to add the gate jobs to build
a py3 docker image

Change-Id: Ifdebde9597a787abcd553756e22261e2faaeedfc
tags/2.23.0
Thiago da Silva 6 months ago
parent
commit
94366fd00e
7 changed files with 98 additions and 92 deletions
  1. +5
    -0
      Dockerfile
  2. +76
    -0
      Dockerfile-py3
  3. +0
    -3
      docker/install_scripts/10_apk_install_prereqs.sh
  4. +0
    -57
      docker/install_scripts/15_install_python_and_pip_src.sh
  5. +7
    -0
      docker/install_scripts/20_apk_install_py2.sh
  6. +0
    -32
      docker/install_scripts/20_pip_install_prereqs.sh
  7. +10
    -0
      docker/install_scripts/21_apk_install_py3.sh

+ 5
- 0
Dockerfile View File

@@ -35,6 +35,11 @@ RUN mkdir /etc/swift && \
echo && \
echo && \
echo && \
echo "================ starting apk_install_py2 ===================" && \
/opt/swift/docker/install_scripts/20_apk_install_py2.sh && \
echo && \
echo && \
echo && \
echo "================ starting swift_install ===================" && \
/opt/swift/docker/install_scripts/50_swift_install.sh && \
echo && \

+ 76
- 0
Dockerfile-py3 View File

@@ -0,0 +1,76 @@
################################################
#
# Alpine 3.10.1 Swift-All-In-One
#
################################################

FROM alpine:3.10.1
MAINTAINER Openstack Swift

ENV S6_LOGGING 1
ENV S6_VERSION 1.21.4.0
ENV SOCKLOG_VERSION 3.0.1-1
ENV ARCH amd64
ENV BUILD_DIR "/tmp"
ENV ENV="/etc/profile"

#COPY docker/install_scripts /install_scripts
COPY . /opt/swift

ADD https://github.com/just-containers/s6-overlay/releases/download/v$S6_VERSION/s6-overlay-$ARCH.tar.gz /tmp/
ADD https://github.com/just-containers/s6-overlay/releases/download/v$S6_VERSION/s6-overlay-$ARCH.tar.gz.sig /tmp/
ADD https://github.com/just-containers/socklog-overlay/releases/download/v$SOCKLOG_VERSION/socklog-overlay-$ARCH.tar.gz /tmp/

RUN mkdir /etc/swift && \
echo && \
echo && \
echo && \
echo "================ starting swift_needs ===================" && \
/opt/swift/docker/install_scripts/00_swift_needs.sh && \
echo && \
echo && \
echo && \
echo "================ starting apk_install_prereqs ===================" && \
/opt/swift/docker/install_scripts/10_apk_install_prereqs.sh && \
echo && \
echo && \
echo && \
echo "================ starting apk_install_py3 ===================" && \
/opt/swift/docker/install_scripts/21_apk_install_py3.sh && \
echo && \
echo && \
echo && \
echo "================ starting swift_install ===================" && \
/opt/swift/docker/install_scripts/50_swift_install.sh && \
echo && \
echo && \
echo && \
echo "================ installing s6-overlay ===================" && \
curl https://keybase.io/justcontainers/key.asc | gpg --import && \
gpg --verify /tmp/s6-overlay-$ARCH.tar.gz.sig /tmp/s6-overlay-$ARCH.tar.gz && \
gunzip -c /tmp/s6-overlay-$ARCH.tar.gz | tar -xf - -C / && \
gunzip -c /tmp/socklog-overlay-amd64.tar.gz | tar -xf - -C / && \
rm -rf /tmp/s6-overlay* && \
rm -rf /tmp/socklog-overlay* && \
echo && \
echo && \
echo && \
echo "================ starting pip_uninstall_dev ===================" && \
/opt/swift/docker/install_scripts/60_pip_uninstall_dev.sh && \
echo && \
echo && \
echo && \
echo "================ starting apk_uninstall_dev ===================" && \
/opt/swift/docker/install_scripts/99_apk_uninstall_dev.sh && \
echo && \
echo && \
echo && \
echo "================ clean up ===================" && \
echo "TODO: cleanup"
#rm -rf /opt/swift


# Add Swift required configuration files
COPY docker/rootfs /

ENTRYPOINT ["/init"]

+ 0
- 3
docker/install_scripts/10_apk_install_prereqs.sh View File

@@ -25,6 +25,3 @@ apk add --update \
libxslt-dev \
libxml2 \
libxml2-dev \
python \
python-dev \
py-pip

+ 0
- 57
docker/install_scripts/15_install_python_and_pip_src.sh View File

@@ -1,57 +0,0 @@
#!/bin/sh
set -e

echo
echo
echo
echo "building python and pip"

# export PATH=$PATH:/usr/include

mkdir $BUILD_DIR/python27
mkdir $BUILD_DIR/python36

echo
echo
echo
echo "building python 2.7.15"

cd $BUILD_DIR/python27
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
tar -zxvf Python-2.7.15.tgz
cd Python-2.7.15
./configure --enable-optimizations
make
make DESTDIR=/opt/python27 install

echo
echo
echo
echo "building python 3.6.5"

cd $BUILD_DIR/python36
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
tar -zxvf Python-3.6.5.tgz
cd Python-3.6.5
./configure --enable-optimizations
make
make DESTDIR=/opt/python36 install

export PATH=$PATH:/opt/python27/usr/local/bin:/opt/python36/usr/local/bin
echo "export PATH=$PATH:/opt/python27/usr/local/bin:/opt/python36/usr/local/bin" >> /etc/profile

echo
echo
echo
echo "building pip"
wget https://bootstrap.pypa.io/get-pip.py
python ./get-pip.py

echo
echo
echo
echo "deleting python internal test dirs"
for f in `cat /opt/swift/docker/install_scripts/python_test_dirs` ; do rm -rf $f; done

rm -rf $BUILD_DIR/python27
rm -rf $BUILD_DIR/python36

+ 7
- 0
docker/install_scripts/20_apk_install_py2.sh View File

@@ -0,0 +1,7 @@
#!/bin/sh
set -e

apk add --update \
python \
python-dev \
py-pip

+ 0
- 32
docker/install_scripts/20_pip_install_prereqs.sh View File

@@ -1,32 +0,0 @@
#!/bin/sh
set -e

echo "+ + + + + + + + + + upgrading pip" && \
pip install -U pip && \
cd /opt/swift && \
pip install -r requirements.txt

#echo "+ + + + + + + + + + installing pastedeploy" && \
#pip install pastedeploy && \
#echo "+ + + + + + + + + + installing eventlet" && \
#pip install eventlet && \
#echo "+ + + + + + + + + + installing greenlet" && \
#pip install greenlet && \
#echo "+ + + + + + + + + + installing netifaces" && \
#pip install netifaces && \
#echo "+ + + + + + + + + + installing setuptools" && \
#pip install setuptools && \
#echo "+ + + + + + + + + + installing requests" && \
#pip install requests && \
#echo "+ + + + + + + + + + installing six" && \
#pip install six && \
#echo "+ + + + + + + + + + installing cryptography" && \
#pip install cryptography && \
#echo "+ + + + + + + + + + installing dnspython" && \
#pip install dnspython
#echo "+ + + + + + + + + + installing xattr" && \
#pip install xattr
#echo "+ + + + + + + + + + installing pyeclib" && \
#pip install pyeclib
#echo "+ + + + + + + + + + installing lxml" && \
#pip install lxml

+ 10
- 0
docker/install_scripts/21_apk_install_py3.sh View File

@@ -0,0 +1,10 @@
#!/bin/sh
set -e

apk add --update \
python3 \
python3-dev \
py3-pip

if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi


Loading…
Cancel
Save