Use alpine linux in all containers

We know use alpine linux in containers to bring a few tool
dependencies we need including lsblk and others.

We know generate ACIs from docker containers instead of
creating ACIs with acbuild.
This commit is contained in:
Bassam Tabbara
2016-10-14 17:02:38 -07:00
parent c22fae449c
commit c1dca04423
9 changed files with 124 additions and 69 deletions
+7 -6
View File
@@ -1,11 +1,12 @@
.glide
.work/
.vscode/
bin/
release/
tools/
vendor/
/.glide
/.work
/bin
/tools
/vendor
/release
coverage.out
coverage.html
+5 -2
View File
@@ -49,10 +49,13 @@ RUN OSXCROSS_COMMIT_HASH=86879571d33ff7252a55d777609742561dba9953 && \
ENV PATH /usr/local/osxcross/bin:$PATH
# install acbuild
# install acbuild and docker2aci
RUN ACBUILD_VERSION=0.4.0 && \
curl -fsSLO https://github.com/containers/build/releases/download/v${ACBUILD_VERSION}/acbuild-v${ACBUILD_VERSION}.tar.gz && \
tar -C /usr/local/bin --strip-components=1 -xzf acbuild-v${ACBUILD_VERSION}.tar.gz
tar -C /usr/local/bin --strip-components=1 -xzf acbuild-v${ACBUILD_VERSION}.tar.gz && \
DOCKER2ACI_VERSION=0.12.3 && \
curl -fsSLO https://github.com/appc/docker2aci/releases/download/v${DOCKER2ACI_VERSION}/docker2aci-v${DOCKER2ACI_VERSION}.tar.gz && \
tar -C /usr/local/bin --strip-components=1 -xzf docker2aci-v${DOCKER2ACI_VERSION}.tar.gz
#
# install multi-arch packages needed to build ceph
+1 -1
View File
@@ -1 +1 @@
0.1.3
0.1.4
+1 -1
View File
@@ -28,7 +28,7 @@ RELEASE_CLIENT_ONLY_PLATFORMS ?=
RELEASE_HOST_PLATFORM ?= $(shell go env GOHOSTOS)_$(shell go env GOHOSTARCH)
# Optional. the flavors to release
RELEASE_FLAVORS := binaries docker aci
RELEASE_FLAVORS := binaries containers
# Optional. Github token repo and user
GITHUB_TOKEN ?=
-57
View File
@@ -1,57 +0,0 @@
#!/bin/bash -e
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${scriptdir}/common.sh
container=quantum.com/castled
build() {
local type=$1
local os=$2
local arch=$3
local version=${RELEASE_VERSION}
[[ ${type} == "both" ]] || return 0
tmpdir=$(mktemp -d)
trap "rm -fr $tmpdir" EXIT
layout_root $os $arch $tmpdir
mkdir -p ${RELEASE_DIR}
local acb="acbuild --debug --work-path $tmpdir"
local acifile=${RELEASE_DIR}/castled-${version}-${os}-${arch}.aci
echo creating aci file ${acifile}
${acb} begin
${acb} set-name ${container}
for f in $(find $tmpdir/root -maxdepth 1); do
${acb} copy-to-dir ${f} /
done
${acb} label add version "$version"
${acb} set-exec -- /usr/bin/castled
${acb} write --overwrite ${acifile}
${acb} end
rm -fr $tmpdir
}
publish() {
local type=$1
local os=$2
local arch=$3
local version=${RELEASE_VERSION}
[[ ${type} == "both" ]] || return 0
local aci=${RELEASE_DIR}/castled-${version}-${os}-${arch}.aci
echo uploading aci file ${acifile}
}
action=$1
shift
${action} "$@"
+58
View File
@@ -0,0 +1,58 @@
#!/bin/bash -e
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${scriptdir}/common.sh
build() {
local type=$1
local os=$2
local arch=$3
local version=${RELEASE_VERSION}
local bindir=$(get_bindir ${os} ${arch})
if [[ ${os} == "windows" ]]; then
local ext=".exe"
fi
local files=( castlectl${ext} )
if [[ ${type} == "both" ]]; then
files+=( castled${ext} )
fi
mkdir -p ${RELEASE_DIR}
if [[ ${os} == "linux" ]]; then
local tarfile=${RELEASE_DIR}/castle-${version}-${os}-${arch}.tar.gz
echo creating tar ${tarfile}
tar czf "${tarfile}" -C "${bindir}" ${files[*]}
else
local zipfile=$(realpath ${RELEASE_DIR}/castle-${version}-${os}-${arch}.zip)
echo creating zip ${zipfile}
$(cd ${bindir} && zip -qr ${zipfile} ${files[*]})
fi
}
publish() {
local type=$1
local os=$2
local arch=$3
local version=${RELEASE_VERSION}
local file=${RELEASE_DIR}/castle-${version}-${os}-${arch}
local ext=tar.gz
local mediatype=gzip
if [[ ${os} != "linux" ]]; then
ext=zip
mediatype=gzip
fi
echo uploading $file.$ext to github
github_upload $file.$ext $mediatype
}
action=$1
shift
${action} "$@"
@@ -17,9 +17,11 @@ build() {
trap "rm -fr $tmpdir" EXIT
layout_root $os $arch $tmpdir
mkdir $tmpdir/root/tmp
cat <<EOF > $tmpdir/Dockerfile
FROM scratch
FROM alpine:3.4
RUN apk add --no-cache gptfdisk util-linux kmod coreutils grep gawk e2fsprogs btrfs-progs sudo
COPY root /
ENTRYPOINT ["/usr/bin/castled"]
EOF
@@ -31,6 +33,17 @@ EOF
echo building docker container ${tag}
docker build -t ${tag} -t quay.io/${tag} $tmpdir
local file=${tag/\//-}
local file=${file/:/-}
local dockerout=${RELEASE_DIR}/${file}.docker
echo ${file}
echo generate ACIs from docker containers
docker save -o ${dockerout} ${tag}
docker2aci ${dockerout}
mv *.aci ${RELEASE_DIR}
rm -fr $tmpdir
}
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash -e
scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${scriptdir}/common.sh
run_platforms() {
local action=${1}
local flavor=${2}
for p in ${RELEASE_CLIENT_SERVER_PLATFORMS}; do
${scriptdir}/${flavor}.sh ${action} both ${p%_*} ${p#*_}
done
for p in ${RELEASE_CLIENT_ONLY_PLATFORMS}; do
${scriptdir}/${flavor}.sh ${action} client ${p%_*} ${p#*_}
done
}
action=$1
shift
case ${action} in
build|publish)
flavor=$1
shift
run_platforms ${action} ${flavor} "$@"
;;
check)
github_check_release "$@"
;;
*)
echo "unknown action ${action}"
exit 1
;;
esac
+1 -1
View File
@@ -10,7 +10,7 @@ coreos:
# - name: 10-local-aci.conf
# content: |
# [Service]
# Environment=CASTLED_ACI=/release/castled-dev-linux-amd64.aci
# Environment=CASTLED_ACI=/release/quantum-castled-dev.aci
# Environment=RKT_OPTIONS=--insecure-options=image
content: |
[Unit]