Skip to content

Instantly share code, notes, and snippets.

@bbrks
Last active November 13, 2019 13:33
Show Gist options
  • Save bbrks/08e4b90a67e25ad8b0bf98655c4e6e1b to your computer and use it in GitHub Desktop.
Save bbrks/08e4b90a67e25ad8b0bf98655c4e6e1b to your computer and use it in GitHub Desktop.
sgcollect_info centos6 builder
#!/bin/bash
## Mostly taken from https://github.com/couchbase/build/blob/master/scripts/jenkins/mobile/sgw_unix_build.sh
WORKING_DIR="/"
SGW_DIR="${WORKING_DIR}sync_gateway/"
PYINSTALLER_USER="user"
echo ======== downloading sync_gateway at $SG_COMMIT =============
curl -L -f -o "${WORKING_DIR}sgsrc.zip" "https://github.com/couchbase/sync_gateway/archive/$SG_COMMIT.zip"
mkdir -p "${WORKING_DIR}sgsrc"
unzip -d "${WORKING_DIR}sgsrc" "${WORKING_DIR}sgsrc.zip"
mkdir -p $SGW_DIR
mv ${WORKING_DIR}/sgsrc/*/* "$SGW_DIR"
echo ======== build sgcollect_info ===============================
chmod -R 777 $SGW_DIR
COLLECTINFO_DIR=${SGW_DIR}tools/
COLLECTINFO_NAME=sgcollect_info
COLLECTINFO_DIST=${COLLECTINFO_DIR}dist/${COLLECTINFO_NAME}
cd ${COLLECTINFO_DIR}
su user
source scl_source enable python27
virtualenv venv
source venv/bin/activate
pip install PyInstaller==2.1
su -c "pyinstaller --onefile ${COLLECTINFO_NAME}" user
if [[ -e ${COLLECTINFO_DIST} ]]
then
echo "..............................SGCOLLECT_INFO Success! Output is: ${COLLECTINFO_DIST}"
else
echo "############################# SGCOLLECT-INFO FAIL! no such file: ${COLLECTINFO_DIST}"
exit 77
fi
FROM centos:6
RUN useradd -d /home/user -m -s /bin/bash user
RUN yum -y update && yum -y install centos-release-scl unzip epel-release && yum -y install python27 python-pip && pip install virtualenv
COPY build.sh /
RUN chmod +x /build.sh
ARG SG_COMMIT="master"
RUN /build.sh
docker build --build-arg SG_COMMIT='release/2.1.2' -t sgcollect-centos6-builder . && \
docker run -d --rm --name sgccos6bld sgcollect-centos6-builder:latest && \
docker cp sgccos6bld:/sync_gateway/tools/dist/sgcollect_info . &&
docker stop sgccos6bld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment