First working draft of docker repository scripts working
This commit is contained in:
parent
563f6d46e4
commit
a359dc3af6
2
.gitignore
vendored
2
.gitignore
vendored
@ -19,4 +19,6 @@ rpm/*RPMS
|
|||||||
rpm/*.log
|
rpm/*.log
|
||||||
rpm/SOURCES
|
rpm/SOURCES
|
||||||
|
|
||||||
|
docker/packages
|
||||||
|
|
||||||
src
|
src
|
||||||
|
@ -1,15 +1,28 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# ./build_dockers.bsh - Build all the docker images
|
||||||
|
# ./build_dockers.bsh lfs_centos_5 lfs_centos_7 - Build only CentOS 5 & 7 image
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
|
CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
|
||||||
|
|
||||||
#This will take a long time the first time
|
#If you are not in docker group and you have sudo, default value is sudo
|
||||||
for IMAGE_DIR in $(ls -d ${CUR_DIR}/*/); do
|
: ${SUDO=`if id -nG | grep -qwv docker && which sudo > /dev/null 2>&1; then echo sudo; fi`}
|
||||||
if [ "$(basename ${IMAGE_DIR})" == "packages" ]; then
|
|
||||||
continue
|
if [[ $# == 0 ]]; then
|
||||||
|
IMAGE_DIRS=($(ls -d ${CUR_DIR}/git-lfs_*/Dockerfile))
|
||||||
|
for i in "${!IMAGE_DIRS[@]}"; do
|
||||||
|
IMAGE_DIRS[$i]=$(dirname ${IMAGE_DIRS[$i]})
|
||||||
|
done
|
||||||
|
unset i
|
||||||
|
else
|
||||||
|
IMAGE_DIRS=("${@}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
#This will take a long time the first time
|
||||||
|
for IMAGE_DIR in "${IMAGE_DIRS[@]}"; do
|
||||||
echo Docker building ${IMAGE_DIR}
|
echo Docker building ${IMAGE_DIR}
|
||||||
docker build -t $(basename ${IMAGE_DIR}) ${IMAGE_DIR}
|
$SUDO docker build -t $(basename ${IMAGE_DIR}) -f ${IMAGE_DIR}/Dockerfile ${CUR_DIR}
|
||||||
done
|
done
|
||||||
|
12
docker/centos_script.bsh
Executable file
12
docker/centos_script.bsh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
mkdir -p /tmp/docker_run
|
||||||
|
cp -r /src /tmp/docker_run/git-lfs
|
||||||
|
|
||||||
|
cd /tmp/docker_run/git-lfs
|
||||||
|
git clean -xdf .
|
||||||
|
/tmp/docker_run/git-lfs/rpm/build_rpms.bsh
|
||||||
|
|
||||||
|
mkdir -p /tmp/docker_run/repo
|
||||||
|
mv /tmp/docker_run/git-lfs/rpm/{SRPMS,RPMS} /tmp/docker_run/repo/
|
||||||
|
createrepo /tmp/docker_run/repo
|
13
docker/debian_script.bsh
Executable file
13
docker/debian_script.bsh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
mkdir -p /tmp/docker_run
|
||||||
|
cp -r /src /tmp/docker_run/git-lfs
|
||||||
|
|
||||||
|
cd /tmp/docker_run/git-lfs
|
||||||
|
git clean -xdf .
|
||||||
|
dpkg-buildpackage -us -uc
|
||||||
|
|
||||||
|
cd /tmp/docker_run
|
||||||
|
mkdir -p /tmp/docker_run/repo
|
||||||
|
mv git-lfs*.* /tmp/docker_run/repo/
|
||||||
|
#create repo?
|
13
docker/git-lfs-full-build_centos_7/Dockerfile
Normal file
13
docker/git-lfs-full-build_centos_7/Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM centos:7
|
||||||
|
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
||||||
|
|
||||||
|
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
||||||
|
LABEL RUN="docker run -v git-lfs-repo-dir:/src"
|
||||||
|
LABEL POST="docker cp containerid:/tmp/docker_run/rpms/RPMS/*"
|
||||||
|
|
||||||
|
RUN yum install -y createrepo
|
||||||
|
|
||||||
|
#Add the simple build repo script
|
||||||
|
ADD centos_script.bsh /tmp/docker_run
|
||||||
|
|
||||||
|
CMD /tmp/docker_run/centos_script
|
@ -2,7 +2,8 @@ FROM centos:5
|
|||||||
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
||||||
|
|
||||||
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
||||||
LABEL RUN="docker run -v git-lfs-repo-dir:/tmp/git-lfs"
|
LABEL RUN="docker run -v git-lfs-repo-dir:/src"
|
||||||
|
LABEL POST="docker cp containerid:/tmp/docker_run/repo*"
|
||||||
|
|
||||||
RUN yum install -y epel-release
|
RUN yum install -y epel-release
|
||||||
RUN yum install -y createrepo rsync git
|
RUN yum install -y createrepo rsync git
|
||||||
@ -15,15 +16,16 @@ ENV DOCKER_LFS_BUILD_VERSION=master
|
|||||||
#ENV DOCKER_LFS_BUILD_VERSION=v0.5.3
|
#ENV DOCKER_LFS_BUILD_VERSION=v0.5.3
|
||||||
#Set to master if you want the lastest, but IF there is a failure,
|
#Set to master if you want the lastest, but IF there is a failure,
|
||||||
#the docker will not build, so I decided to make a stable version the default
|
#the docker will not build, so I decided to make a stable version the default
|
||||||
|
ADD https://github.com/github/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
||||||
#ADD https://github.com/github/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
RUN cd /tmp/docker_setup/; \
|
||||||
#TODO: Change these two lines back after next merge
|
tar zxf ${DOCKER_LFS_BUILD_VERSION}.tar.gz
|
||||||
ENV DOCKER_LFS_BUILD_VERSION=git_for_centos
|
RUN cd /tmp/docker_setup/git-lfs-*/rpm; \
|
||||||
ADD https://github.com/andyneff/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
touch build.log; \
|
||||||
WORKDIR /tmp/docker_setup/
|
tail -f build.log & ./build_rpms.bsh; \
|
||||||
RUN tar zxf ${DOCKER_LFS_BUILD_VERSION}.tar.gz
|
pkill tail
|
||||||
RUN cd /tmp/docker_setup/git-lfs-*/rpm; touch build.log; tail -f build.log & ./build_rpms.bsh; pkill tail
|
|
||||||
WORKDIR /tmp/git-lfs/rpm
|
|
||||||
RUN rm -rf /tmp/docker_setup
|
RUN rm -rf /tmp/docker_setup
|
||||||
|
|
||||||
CMD /tmp/git-lfs/rpm/build_rpms.bsh
|
#Add the simple build repo script
|
||||||
|
ADD centos_script.bsh /tmp/docker_run/
|
||||||
|
|
||||||
|
CMD /tmp/docker_run/centos_script.bsh
|
@ -2,7 +2,8 @@ FROM centos:6
|
|||||||
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
||||||
|
|
||||||
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
||||||
#LABEL RUN="docker run -v git-lfs-repo-dir:/tmp/git-lfs"
|
LABEL RUN="docker run -v git-lfs-repo-dir:/src"
|
||||||
|
LABEL POST="docker cp containerid:/tmp/docker_run/repo*"
|
||||||
|
|
||||||
RUN yum install -y epel-release
|
RUN yum install -y epel-release
|
||||||
RUN yum install -y createrepo rsync golang tar
|
RUN yum install -y createrepo rsync golang tar
|
||||||
@ -15,15 +16,16 @@ ENV DOCKER_LFS_BUILD_VERSION=master
|
|||||||
#ENV DOCKER_LFS_BUILD_VERSION=v0.5.3
|
#ENV DOCKER_LFS_BUILD_VERSION=v0.5.3
|
||||||
#Set to master if you want the lastest, but IF there is a failure,
|
#Set to master if you want the lastest, but IF there is a failure,
|
||||||
#the docker will not build, so I decided to make a stable version the default
|
#the docker will not build, so I decided to make a stable version the default
|
||||||
|
ADD https://github.com/github/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
||||||
#ADD https://github.com/github/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
RUN cd /tmp/docker_setup/; \
|
||||||
#TODO: Change these two lines back after next merge
|
tar zxf ${DOCKER_LFS_BUILD_VERSION}.tar.gz
|
||||||
ENV DOCKER_LFS_BUILD_VERSION=git_for_centos
|
RUN cd /tmp/docker_setup/git-lfs-*/rpm; \
|
||||||
ADD https://github.com/andyneff/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
touch build.log; \
|
||||||
WORKDIR /tmp/docker_setup/
|
tail -f build.log & ./build_rpms.bsh; \
|
||||||
RUN tar zxf ${DOCKER_LFS_BUILD_VERSION}.tar.gz
|
pkill tail
|
||||||
RUN cd /tmp/docker_setup/git-lfs-*/rpm; touch build.log; tail -f build.log & ./build_rpms.bsh; pkill tail
|
|
||||||
WORKDIR /tmp/git-lfs/rpm
|
|
||||||
RUN rm -rf /tmp/docker_setup
|
RUN rm -rf /tmp/docker_setup
|
||||||
|
|
||||||
CMD touch build.log; tail -f build.log & ./build_rpms.bsh
|
#Add the simple build repo script
|
||||||
|
ADD centos_script.bsh /tmp/docker_run/
|
||||||
|
|
||||||
|
CMD /tmp/docker_run/centos_script.bsh
|
@ -2,27 +2,29 @@ FROM centos:7
|
|||||||
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
||||||
|
|
||||||
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
||||||
LABEL RUN="docker run -v git-lfs-repo-dir:/tmp/git-lfs"
|
LABEL RUN="docker run -v git-lfs-repo-dir:/src"
|
||||||
|
LABEL POST="docker cp containerid:/tmp/docker_run/repo*"
|
||||||
|
|
||||||
RUN yum install -y createrepo rsync git ruby ruby-devel golang
|
RUN yum install -y createrepo rsync git ruby ruby-devel golang
|
||||||
|
|
||||||
#The purpose of this is to build and install everything needed to build git-lfs
|
#The purpose of this is to build and install everything needed to build git-lfs
|
||||||
#Next time. So that the LONG build/installed in centos are only done once, and
|
#Next time. So that the LONG build/installed in centos are only done once, and
|
||||||
#Store in the image
|
#stored in the image.
|
||||||
|
|
||||||
ENV DOCKER_LFS_BUILD_VERSION=master
|
ENV DOCKER_LFS_BUILD_VERSION=master
|
||||||
#ENV DOCKER_LFS_BUILD_VERSION=v0.5.3
|
#ENV DOCKER_LFS_BUILD_VERSION=v0.5.3
|
||||||
#Set to master if you want the lastest, but IF there is a failure,
|
#Set to master if you want the lastest, but IF there is a failure,
|
||||||
#the docker will not build, so I decided to make a stable version the default
|
#the docker will not build, so I decided to make a stable version the default
|
||||||
|
ADD https://github.com/github/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
||||||
#ADD https://github.com/github/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
RUN cd /tmp/docker_setup/; \
|
||||||
#TODO: Change these two lines back after next merge
|
tar zxf ${DOCKER_LFS_BUILD_VERSION}.tar.gz
|
||||||
ENV DOCKER_LFS_BUILD_VERSION=git_for_centos
|
RUN cd /tmp/docker_setup/git-lfs-*/rpm; \
|
||||||
ADD https://github.com/andyneff/git-lfs/archive/${DOCKER_LFS_BUILD_VERSION}.tar.gz /tmp/docker_setup/
|
touch build.log; \
|
||||||
WORKDIR /tmp/docker_setup/
|
tail -f build.log & ./build_rpms.bsh; \
|
||||||
RUN tar zxf ${DOCKER_LFS_BUILD_VERSION}.tar.gz
|
pkill tail
|
||||||
RUN cd /tmp/docker_setup/git-lfs-*/rpm; touch build.log; tail -f build.log & ./build_rpms.bsh; pkill tail
|
|
||||||
RUN rm -rf /tmp/docker_setup
|
RUN rm -rf /tmp/docker_setup
|
||||||
|
|
||||||
WORKDIR /tmp
|
#Add the simple build repo script
|
||||||
CMD /tmp/git-lfs/rpm/build_rpms.bsh
|
ADD centos_script.bsh /tmp/docker_run/
|
||||||
|
|
||||||
|
CMD /tmp/docker_run/centos_script.bsh
|
@ -1,14 +1,15 @@
|
|||||||
FROM debian:wheezy
|
FROM debian:wheezy
|
||||||
|
|
||||||
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
||||||
|
|
||||||
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
||||||
LABEL RUN="docker run -v git-lfs-repo-dir:/tmp/git-lfs"
|
LABEL RUN="docker run -v git-lfs-repo-dir:/tmp/src"
|
||||||
|
LABEL POST="docker cp containerid:/tmp/docker_run/repo*"
|
||||||
|
|
||||||
RUN echo 'deb http://http.debian.net/debian wheezy-backports main' > /etc/apt/sources.list.d/wheezy-backports-main.list
|
RUN echo 'deb http://http.debian.net/debian wheezy-backports main' > /etc/apt/sources.list.d/wheezy-backports-main.list
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update && \
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update && \
|
||||||
apt-get install -y -t wheezy-backports golang git dpkg-dev dh-golang ruby-ronn
|
apt-get install -y -t wheezy-backports golang git dpkg-dev dh-golang ruby-ronn
|
||||||
|
|
||||||
WORKDIR /tmp/git-lfs/
|
ADD debian_script.bsh /tmp/docker_run/
|
||||||
CMD ["dpkg-buildpackage", "-us", "-uc"]
|
|
||||||
|
CMD /tmp/docker_run/debian_script.bsh
|
@ -1,12 +1,13 @@
|
|||||||
FROM debian:jessie
|
FROM debian:jessie
|
||||||
|
|
||||||
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
MAINTAINER Andy Neff <andyneff@users.noreply.github.com>
|
||||||
|
|
||||||
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
#Docker RUN example, pass in the git-lfs checkout copy you are working with
|
||||||
LABEL RUN="docker run -v git-lfs-repo-dir:/tmp/git-lfs"
|
LABEL RUN="docker run -v git-lfs-repo-dir:/src
|
||||||
|
LABEL POST="docker cp containerid:/tmp/docker_run/repo*"
|
||||||
|
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update && \
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update && \
|
||||||
apt-get install -y golang git dpkg-dev dh-golang ruby-ronn
|
apt-get install -y golang git dpkg-dev dh-golang ruby-ronn
|
||||||
|
|
||||||
WORKDIR /tmp/git-lfs/
|
ADD debian_script.bsh /tmp/docker_run/
|
||||||
CMD ["dpkg-buildpackage", "-us", "-uc"]
|
|
||||||
|
CMD /tmp/docker_run/debian_script.bsh
|
@ -1,48 +1,50 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
# ./run_dockers.bsh - Run all the docker images
|
||||||
|
# ./run_dockers.bsh lfs_centos_5 lfs_centos_7 - Run only CentOS 5 & 7 image
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
|
CUR_DIR=$(dirname "${BASH_SOURCE[0]}")
|
||||||
REPO_DIR=$(cd ${CUR_DIR}/..; pwd)
|
REPO_DIR=$(cd ${CUR_DIR}/..; pwd)
|
||||||
DOCKER_UID=${DOCKER_UID=`id -u`} #Not REALLY used yet
|
|
||||||
DOCKER_GID=${DOCKER_GID=`id -u`} #Not REALLY used yet
|
|
||||||
PACKAGE_DIR=${CUR_DIR}/packages
|
PACKAGE_DIR=${CUR_DIR}/packages
|
||||||
BUILD_LOCAL=1
|
BUILD_LOCAL=1
|
||||||
|
|
||||||
SUDO=${SUDO=`if which sudo > /dev/null 2>&1; then echo sudo; fi`}
|
#If you are not in docker group and you have sudo, default value is sudo
|
||||||
|
: ${SUDO=`if id -nG | grep -qwv docker && which sudo > /dev/null 2>&1; then echo sudo; fi`}
|
||||||
|
|
||||||
mkdir -p "${PACKAGE_DIR}"
|
function split_image_name()
|
||||||
#Run docker to build rpm/deb
|
{ #$1 - image directory name or dockerfile
|
||||||
for IMAGE_DIR in $(ls -d ${CUR_DIR}/*/); do
|
#sets IMAGE_NAME to the basename of the dir containing the docker file
|
||||||
IMAGE_NAME=$(basename ${IMAGE_DIR})
|
#sets IMAGE_INFO to be the array name following my pattern
|
||||||
|
IMAGE_NAME=$(basename $1)
|
||||||
OLD_IFS=${IFS}
|
if [ "${IMAGE_NAME,,}" == "dockerfile" ]; then
|
||||||
IFS=_
|
IMAGE_NAME=$(basename $(dirname $1))
|
||||||
IMAGE_INFO=(${IMAGE_NAME})
|
|
||||||
IFS=${OLD_IFS}
|
|
||||||
|
|
||||||
if [ "${IMAGE_NAME}" == "packages" ]; then
|
|
||||||
continue
|
|
||||||
elif [[ ${IMAGE_NAME} == *"centos"* ]]; then
|
|
||||||
${REPO_DIR}/rpm/clean.bsh
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo Compiling in docker image ${IMAGE_NAME}
|
local IFS=_
|
||||||
$SUDO docker run -e BUILD_LOCAL=${BUILD_LOCAL} -v ${REPO_DIR}:/tmp/git-lfs --name git-lfs_build_container ${IMAGE_NAME}
|
IMAGE_INFO=(${IMAGE_NAME})
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ $# == 0 ]]; then
|
||||||
|
IMAGES=($(ls -d ${CUR_DIR}/git-lfs_*/Dockerfile))
|
||||||
|
else
|
||||||
|
IMAGES=("${@}")
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${PACKAGE_DIR}"
|
||||||
|
#Run docker to build pacakges
|
||||||
|
for DOCKER_FILE in "${IMAGES[@]}"; do
|
||||||
|
split_image_name "${DOCKER_FILE}" #set IMAGE_NAME and IMAGE_INFO
|
||||||
|
|
||||||
|
echo Compiling LFS in docker image ${IMAGE_NAME}
|
||||||
|
$SUDO docker run -e BUILD_LOCAL=${BUILD_LOCAL} -v ${REPO_DIR}:/src --name git-lfs_build_container ${IMAGE_NAME}
|
||||||
|
|
||||||
IMAGE_REPO_DIR="${PACKAGE_DIR}"/"${IMAGE_INFO[1]}"/"${IMAGE_INFO[2]}"
|
IMAGE_REPO_DIR="${PACKAGE_DIR}"/"${IMAGE_INFO[1]}"/"${IMAGE_INFO[2]}"
|
||||||
mkdir -p "${IMAGE_REPO_DIR}"
|
mkdir -p "${IMAGE_REPO_DIR}"
|
||||||
|
|
||||||
#Quick hack until I make the docker do this for real
|
$SUDO docker cp git-lfs_build_container:/tmp/docker_run/repo/ ${IMAGE_REPO_DIR}
|
||||||
$SUDO chown -R ${DOCKER_UID}:${DOCKER_GID} ${REPO_DIR}
|
|
||||||
|
|
||||||
if [[ ${IMAGE_NAME} == *"centos"* ]]; then
|
|
||||||
cp -rv ${REPO_DIR}/rpm/{RPMS,SRPMS} ${IMAGE_REPO_DIR}
|
|
||||||
elif [[ ${IMAGE_NAME} == *"debian"* ]]; then
|
|
||||||
$SUDO docker cp git-lfs_build_container:tmp ${IMAGE_REPO_DIR}
|
|
||||||
$SUDO mv ${IMAGE_REPO_DIR}/tmp/git-lfs_* ${IMAGE_REPO_DIR}
|
|
||||||
$SUDO rm -rf ${IMAGE_REPO_DIR}/tmp
|
|
||||||
fi
|
|
||||||
|
|
||||||
$SUDO docker kill git-lfs_build_container
|
$SUDO docker kill git-lfs_build_container
|
||||||
$SUDO docker rm git-lfs_build_container
|
$SUDO docker rm git-lfs_build_container
|
||||||
|
Loading…
Reference in New Issue
Block a user